final class DefaultThreadControl
extends java.lang.Object
implements org.apache.excalibur.thread.ThreadControl
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Thread |
m_thread |
private java.lang.Throwable |
m_throwable |
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultThreadControl(java.lang.Thread thread)
Construct thread control for a specific thread.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
finish(java.lang.Throwable throwable)
Method called by thread to release control.
|
java.lang.Throwable |
getThrowable()
Retrieve throwable that caused thread to cease execution.
|
void |
interrupt()
Call Thread.interrupt() on thread being controlled.
|
void |
interupt() |
boolean |
isFinished()
Determine if thread has finished execution
|
void |
join(long milliSeconds)
Wait for specified time for thread to complete it's work.
|
private java.lang.Thread m_thread
private java.lang.Throwable m_throwable
protected DefaultThreadControl(java.lang.Thread thread)
thread - the thread to controlpublic void join(long milliSeconds)
throws java.lang.IllegalStateException,
java.lang.InterruptedException
join in interface org.apache.excalibur.thread.ThreadControlmilliSeconds - the duration in milliseconds to wait until the thread has finished workjava.lang.IllegalStateException - if isValid() == falsejava.lang.InterruptedException - if another thread has interrupted the current thread.
The interrupted status of the current thread is cleared when this exception
is thrown.public void interupt()
throws java.lang.IllegalStateException,
java.lang.SecurityException
java.lang.IllegalStateExceptionjava.lang.SecurityExceptionpublic void interrupt()
throws java.lang.IllegalStateException,
java.lang.SecurityException
interrupt in interface org.apache.excalibur.thread.ThreadControljava.lang.IllegalStateException - if isValid() == falsejava.lang.SecurityException - if caller does not have permission to call interupt()public boolean isFinished()
isFinished in interface org.apache.excalibur.thread.ThreadControlpublic java.lang.Throwable getThrowable()
getThrowable in interface org.apache.excalibur.thread.ThreadControlprotected void finish(java.lang.Throwable throwable)
throwable - Throwable that caused thread to complete (may be null)