Package org.eclipse.jdt.debug.core
Interface IJavaThread
- All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
,org.eclipse.debug.core.model.IDebugElement
,org.eclipse.debug.core.model.IFilteredStep
,org.eclipse.debug.core.model.IStep
,org.eclipse.debug.core.model.ISuspendResume
,org.eclipse.debug.core.model.ITerminate
,org.eclipse.debug.core.model.IThread
public interface IJavaThread
extends org.eclipse.debug.core.model.IThread, org.eclipse.debug.core.model.IFilteredStep
A thread in a Java virtual machine.
- See Also:
-
IThread
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Status code indicating a request to perform a message send failed because a thread was not suspended by a step or breakpoint event.static final int
Status code indicating a request to perform a message send failed because a thread was already performing a message send.static final int
Status code indicating a request failed because a thread was not suspended. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the currently executingIEvaluationRunnable
supports termination.findVariable
(String variableName) Returns a variable with the given name, ornull
if unable to resolve a variable with the name, or if this thread is not currently suspended.Returns a Java object for the monitor for which this thread is currently waiting ornull
.int
Returns the number of frames in this thread.Returns the monitors owned by this thread ornull
if this thread owns no monitors.Returns the thread group this thread belongs to ornull
if none.Returns the name of the thread group this thread belongs to, ornull
if none.Returns the object reference associated with this thread.boolean
Returns whether this threads owns at least one monitor.boolean
isDaemon()
Returns whether this thread is a daemon thread.boolean
Returns whether any of the stack frames associated with this thread are running code in the VM that is out of synch with the code in the workspace.boolean
Returns whether this thread is currently performing an evaluation.boolean
Returns whether this thread is a system thread.boolean
Returns whether this thread may be running code in the VM that is out of synch with the code in the workspace.void
queueRunnable
(Runnable runnable) Queues the given runnable with the list of runnables associated with this thread.void
runEvaluation
(IEvaluationRunnable evaluation, org.eclipse.core.runtime.IProgressMonitor monitor, int evaluationDetail, boolean hitBreakpoints) Invokes the given evaluation with the specified progress monitor.void
stop
(IJavaObject exception) Request to stops this thread with the given exception.
The result will be the same as calling java.lang.Thread#stop(java.lang.Throwable).
If the thread is suspended when the method is called, the thread must be resumed to complete the action.
exception must represent an exception.void
Attempts to terminate the currently executingIEvaluationRunnable
in this thread, if any.Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getDebugTarget, getLaunch, getModelIdentifier
Methods inherited from interface org.eclipse.debug.core.model.IFilteredStep
canStepWithFilters, stepWithFilters
Methods inherited from interface org.eclipse.debug.core.model.IStep
canStepInto, canStepOver, canStepReturn, isStepping, stepInto, stepOver, stepReturn
Methods inherited from interface org.eclipse.debug.core.model.ISuspendResume
canResume, canSuspend, isSuspended, resume, suspend
Methods inherited from interface org.eclipse.debug.core.model.ITerminate
canTerminate, isTerminated, terminate
Methods inherited from interface org.eclipse.debug.core.model.IThread
getBreakpoints, getName, getPriority, getStackFrames, getTopStackFrame, hasStackFrames
-
Field Details
-
ERR_THREAD_NOT_SUSPENDED
static final int ERR_THREAD_NOT_SUSPENDEDStatus code indicating a request failed because a thread was not suspended.- See Also:
-
ERR_NESTED_METHOD_INVOCATION
static final int ERR_NESTED_METHOD_INVOCATIONStatus code indicating a request to perform a message send failed because a thread was already performing a message send. -
ERR_INCOMPATIBLE_THREAD_STATE
static final int ERR_INCOMPATIBLE_THREAD_STATEStatus code indicating a request to perform a message send failed because a thread was not suspended by a step or breakpoint event. When a thread is suspended explicitly via thesuspend()
method, it is not able to perform method invocations (this is a JDI limitation).
-
-
Method Details
-
isSystemThread
boolean isSystemThread() throws org.eclipse.debug.core.DebugExceptionReturns whether this thread is a system thread.- Returns:
- whether this thread is a system thread
- Throws:
org.eclipse.debug.core.DebugException
- if this method fails. Reasons include:- Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.
-
isOutOfSynch
boolean isOutOfSynch() throws org.eclipse.debug.core.DebugExceptionReturns whether any of the stack frames associated with this thread are running code in the VM that is out of synch with the code in the workspace.- Returns:
- whether this thread is out of synch with the workspace.
- Throws:
org.eclipse.debug.core.DebugException
- if this method fails. Reasons include:- Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.
- Since:
- 2.0
-
mayBeOutOfSynch
boolean mayBeOutOfSynch() throws org.eclipse.debug.core.DebugExceptionReturns whether this thread may be running code in the VM that is out of synch with the code in the workspace.- Returns:
- whether this thread may be out of synch with the workspace.
- Throws:
org.eclipse.debug.core.DebugException
- if this method fails. Reasons include:- Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.
- Since:
- 2.0
-
isPerformingEvaluation
boolean isPerformingEvaluation()Returns whether this thread is currently performing an evaluation.- Returns:
- whether this thread is currently performing an evaluation
- Since:
- 2.0
-
getThreadGroupName
Returns the name of the thread group this thread belongs to, ornull
if none.- Returns:
- thread group name, or
null
if none - Throws:
org.eclipse.debug.core.DebugException
- if this method fails. Reasons include:- Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.
-
findVariable
Returns a variable with the given name, ornull
if unable to resolve a variable with the name, or if this thread is not currently suspended.Variable lookup works only when a thread is suspended. Lookup is performed in all stack frames, in a top-down order, returning the first successful match, or
null
if no match is found.- Parameters:
variableName
- the name of the variable to search for- Returns:
- a variable, or
null
if none - Throws:
org.eclipse.debug.core.DebugException
- if this method fails. Reasons include:- Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.
-
runEvaluation
void runEvaluation(IEvaluationRunnable evaluation, org.eclipse.core.runtime.IProgressMonitor monitor, int evaluationDetail, boolean hitBreakpoints) throws org.eclipse.debug.core.DebugException Invokes the given evaluation with the specified progress monitor. This thread fires a resume event when the evaluation begins, and a suspend event when the evaluation completes or throws an exception. The events are given a detail as specified byevaluationDetail
(one ofDebugEvent.EVALUATION
orDebugEvent.EVALUATION_IMPLICIT
).Since 3.5, the
org.eclipse.jdt.debug.breakpointListeners
extension point supports evaluation execution during a listener call back. Suspend and resume events are not fired during listener call backs. Unspecified model specific events are fired.- Parameters:
evaluation
- the evaluation to performmonitor
- progress monitor (may benull
evaluationDetail
- one ofDebugEvent.EVALUATION
orDebugEvent.EVALUATION_IMPLICIT
hitBreakpoints
- whether or not breakpoints should be honored in this thread during the evaluation. Iffalse
, breakpoints hit in this thread during the evaluation will be ignored.- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs performing the evaluation- Since:
- 2.0
-
queueRunnable
Queues the given runnable with the list of runnables associated with this thread. Runnables are executed asynchronously in a separate thread. This method should be used to execute any code which performs an operation like a method invocation.- Parameters:
runnable
- the runnable to execute.- Since:
- 2.1
-
terminateEvaluation
void terminateEvaluation() throws org.eclipse.debug.core.DebugExceptionAttempts to terminate the currently executingIEvaluationRunnable
in this thread, if any. Evaluations may be composed of a series of instructions. Terminating an evaluation means stopping the evaluation after the current instruction completes. A single instruction (such as a method invocation) cannot be interrupted.- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs while terminating the evaluation.- Since:
- 2.1
-
canTerminateEvaluation
boolean canTerminateEvaluation()Returns whether the currently executingIEvaluationRunnable
supports termination. An IEvaluationRunnable supports termination if it implementsITerminate
- Returns:
- whether the current evaluation supports termination
- Since:
- 2.1
-
getContendedMonitor
Returns a Java object for the monitor for which this thread is currently waiting ornull
.- Returns:
- IJavaObject the contended monitor object or
null
if this thread is not waiting on a monitor. - Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs while retrieving the contended monitor.- Since:
- 2.1
-
getOwnedMonitors
Returns the monitors owned by this thread ornull
if this thread owns no monitors.- Returns:
- the owned monitors
- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs while retrieving the owned monitors of this thread.- Since:
- 2.1
-
hasOwnedMonitors
boolean hasOwnedMonitors() throws org.eclipse.debug.core.DebugExceptionReturns whether this threads owns at least one monitor.- Returns:
- boolean whether this thread owns a monitor
- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs determining if there are owned monitors.- Since:
- 2.1
-
stop
Request to stops this thread with the given exception.
The result will be the same as calling java.lang.Thread#stop(java.lang.Throwable).
If the thread is suspended when the method is called, the thread must be resumed to complete the action.
exception must represent an exception.- Parameters:
exception
- the exception to throw.- Throws:
org.eclipse.debug.core.DebugException
- if the request fails- Since:
- 3.0
- See Also:
-
getThreadGroup
Returns the thread group this thread belongs to ornull
if none.- Returns:
- thread group or
null
- Throws:
org.eclipse.debug.core.DebugException
- if the thread group cannot be computed- Since:
- 3.2
-
isDaemon
boolean isDaemon() throws org.eclipse.debug.core.DebugExceptionReturns whether this thread is a daemon thread.- Returns:
- whether this thread is a daemon thread
- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs while determining status- Since:
- 3.3
-
getFrameCount
int getFrameCount() throws org.eclipse.debug.core.DebugExceptionReturns the number of frames in this thread.- Returns:
- number of stack frames
- Throws:
org.eclipse.debug.core.DebugException
- if an exception occurs while retrieving the count- Since:
- 3.3
-
getThreadObject
Returns the object reference associated with this thread.- Returns:
- thread object reference
- Throws:
org.eclipse.debug.core.DebugException
- if unable to retrieve an object reference- Since:
- 3.6
-