Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 102556 Details for
Bug 233319
Initial JDIThread state can get out-of-sync with its underlying ThreadReference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch to org.eclipse.jdt.debug
jdt.txt (text/plain), 2.91 KB, created by
Samantha Chan
on 2008-05-28 22:25:58 EDT
(
hide
)
Description:
patch to org.eclipse.jdt.debug
Filename:
MIME Type:
Creator:
Samantha Chan
Created:
2008-05-28 22:25:58 EDT
Size:
2.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug >Index: model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java,v >retrieving revision 1.183 >diff -u -r1.183 JDIThread.java >--- model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java 31 Mar 2008 16:25:52 -0000 1.183 >+++ model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java 29 May 2008 02:08:00 -0000 >@@ -78,6 +78,17 @@ > */ > public class JDIThread extends JDIDebugElement implements IJavaThread { > >+ // Timeout setting for checking initial thread state >+ // JDIThread will keep asking the ThreadReference for thread state if it is >+ // suspended until the timeout has expired >+ private static final long THREAD_STATE_TIMEOUT = 1000; >+ >+ // Timestamp when this thread is created >+ private long fCreationTimestamp = System.currentTimeMillis(); >+ >+ // flag to indicate if the thread should refresh thread state >+ private boolean fCheckThreadState = false; >+ > /** > * Constant for the name of the default Java stratum > */ >@@ -299,7 +310,14 @@ > // This may be a transient suspend state (for example, a thread is handling a > // class prepare event quietly). The class prepare event handler will notify > // this thread when it resumes >- setRunning(!fThread.isSuspended()); >+ boolean suspended = fThread.isSuspended(); >+ if (suspended) { >+ // we can be in transient suspend state, set thread state to >+ // true; >+ fCheckThreadState = true; >+ } >+ >+ setRunning(!suspended); > } catch (VMDisconnectedException e) { > disconnected(); > return; >@@ -1107,8 +1125,37 @@ > * @see ISuspendResume#isSuspended() > */ > public boolean isSuspended() { >+ >+ if (fCheckThreadState) >+ { >+ long currentTime = System.currentTimeMillis(); >+ if ((currentTime - fCreationTimestamp) > THREAD_STATE_TIMEOUT) >+ { >+ // check thread state time out, set fCheckThreadState to false >+ fCheckThreadState = false; >+ } >+ >+ // Need to refresh one last time after timeout >+ // This is to handle the case where no one has asked if this thread >+ // is suspended in the first 500 ms. (e.g. the thread is suspended but hidden in a view.) >+ // When the thread becomes visible, the state of the thread needs to be refreshed. >+ refreshThreadState(); >+ } >+ > return !fRunning && !fTerminated; > } >+ >+ // Since this is in an internal package, can this be a >+ // public method? >+ private void refreshThreadState() { >+ try { >+ boolean suspended = fThread.isSuspended(); >+ setRunning(!suspended); >+ } catch (Exception e) { >+ // handle all errors silently as we may get into >+ // trouble when thread/VM is gone soon after it has been created >+ } >+ } > > /** > * @see ISuspendResume#isSuspended()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233319
: 102556