|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.ibm.jvm.InterruptibleThread
public class InterruptibleThread
InterruptibleThread
is a utility class that extends
java.lang.Thread
, to allow the wrapping of interruptible runnable
methods. Use InterruptibleThread
instead of
java.lang.Thread
when you instantiate a thread, if you might need
to unblock that thread from a synchronization or networking operation.
You can use InterruptibleThread
to check if a thread is being blocked
on a synchronization or networking call. If the thread is blocked it can then
be unblocked if required.
It uses instances of classes InterruptibleLockContext
and
InterruptibleIOContext
to perform the required isblocked()
and unblock()
methods depending upon whether a synchronization or
networking operation is blocking the thread.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
InterruptibleThread()
Allocates a new InterruptibleThread object and calls it's
superclass constructor. |
|
InterruptibleThread(java.lang.Runnable runnable)
Allocates a new InterruptibleThread object. |
|
InterruptibleThread(java.lang.Runnable runnable,
java.lang.String threadName)
Allocates a new InterruptibleThread object. |
|
InterruptibleThread(java.lang.String threadName)
Allocates a new InterruptibleThread object. |
|
InterruptibleThread(java.lang.ThreadGroup group,
java.lang.Runnable runnable)
Allocates a new InterruptibleThread object . |
|
InterruptibleThread(java.lang.ThreadGroup group,
java.lang.Runnable runnable,
java.lang.String threadName)
Allocates a new InterruptibleThread object. |
|
InterruptibleThread(java.lang.ThreadGroup group,
java.lang.Runnable runnable,
java.lang.String threadName,
long stack)
Allocates a new InterruptibleThread object. |
|
InterruptibleThread(java.lang.ThreadGroup group,
java.lang.String threadName)
Allocates a new InterruptibleThread object. |
Method Summary | |
---|---|
boolean |
isBlocked()
Checks to see if the OS thread is blocked on a synchronized or networking call. |
void |
run()
Calls its superclass's run method and then contructs an
InterruptibleIOContext and InterruptibleLockContext
object, which are used by calls to isBlocked() and unBlock() ,
depending on whether the thread is blocking on a synchronization or networking call. |
void |
unBlock()
Break the associated OS thread out of the blocking synchronization or networking call. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InterruptibleThread()
InterruptibleThread
object and calls it's
superclass constructor.
Thread
public InterruptibleThread(java.lang.Runnable runnable)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
runnable
- the object whose run method is called.Thread
,
Thread.Thread(Runnable runnable)
public InterruptibleThread(java.lang.Runnable runnable, java.lang.String threadName)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
runnable
- the object whose run method is called.threadName
- the name of the new thread.Thread
,
Thread.Thread(Runnable runnable, String threadName)
public InterruptibleThread(java.lang.String threadName)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
threadName
- the name of the new thread.Thread
,
Thread.Thread(String threadName)
public InterruptibleThread(java.lang.ThreadGroup group, java.lang.Runnable runnable)
InterruptibleThread object
. The constructor just calls
its superclass constructor.
group
- the thread group.runnable
- the object whose run method is called.Thread
,
Thread.Thread(ThreadGroup group, Runnable runnable)
public InterruptibleThread(java.lang.ThreadGroup group, java.lang.Runnable runnable, java.lang.String threadName)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
group
- the thread group.runnable
- the object whose run method is called.threadName
- the name of the new thread.Thread
,
Thread.Thread(ThreadGroup group, Runnable runnable, String threadName)
public InterruptibleThread(java.lang.ThreadGroup group, java.lang.Runnable runnable, java.lang.String threadName, long stack)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
group
- the thread group.runnable
- the object whose run method is called.threadName
- the name of the new thread.stack
- stack size for the new thread, or zero if the parameter is to be ignored.Thread
,
Thread.Thread(ThreadGroup group, Runnable runnable, String threadName, long stack)
public InterruptibleThread(java.lang.ThreadGroup group, java.lang.String threadName)
InterruptibleThread
object. The constructor just calls
its superclass constructor.
group
- the thread group.threadName
- the name of the new thread.Thread
,
Thread.Thread(ThreadGroup group, String threadName)
Method Detail |
---|
public void run()
run
method and then contructs an
InterruptibleIOContext
and InterruptibleLockContext
object, which are used by calls to isBlocked()
and unBlock()
,
depending on whether the thread is blocking on a synchronization or networking call.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
Thread
public boolean isBlocked()
true
if OS thread is blocked false
otherwise.public void unBlock()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |