org.apache.excalibur.thread.impl
Class DefaultThreadControl
java.lang.Object
org.apache.excalibur.thread.impl.DefaultThreadControl
- All Implemented Interfaces:
- ThreadControl
- final class DefaultThreadControl
- extends java.lang.Object
- implements ThreadControl
Default implementation of ThreadControl interface. Is used by worker thread to supply control information to the clients of thread pool.
- Author:
| Constructor Summary |
protected |
DefaultThreadControl(java.lang.Thread thread)
Construct thread control for a specific thread. |
| Method Summary |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_thread
private java.lang.Thread m_thread
-
m_throwable
private java.lang.Throwable m_throwable
-
DefaultThreadControl
protected DefaultThreadControl(java.lang.Thread thread)
-
Construct thread control for a specific thread.
- Parameters:
thread - the thread to control
join
public void join(long milliSeconds)
throws java.lang.IllegalStateException,
java.lang.InterruptedException
-
Wait for specified time for thread to complete it's work.
-
- Specified by:
join in interface ThreadControl
-
- Parameters:
milliSeconds - the duration in milliseconds to wait until the thread has finished work
- Throws:
java.lang.IllegalStateException - if isValid() == false
java.lang.InterruptedException - if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
interupt
public void interupt()
throws java.lang.IllegalStateException,
java.lang.SecurityException
-
-
- Throws:
java.lang.IllegalStateException
java.lang.SecurityException
interrupt
public void interrupt()
throws java.lang.IllegalStateException,
java.lang.SecurityException
-
Call Thread.interrupt() on thread being controlled.
-
- Specified by:
interrupt in interface ThreadControl
-
- Throws:
java.lang.IllegalStateException - if isValid() == false
java.lang.SecurityException - if caller does not have permission to call interupt()
isFinished
public boolean isFinished()
-
Determine if thread has finished execution
-
- Specified by:
isFinished in interface ThreadControl
-
- Returns:
- true if thread is finished, false otherwise
getThrowable
public java.lang.Throwable getThrowable()
-
Retrieve throwable that caused thread to cease execution. Only valid when true == isFinished()
-
- Specified by:
getThrowable in interface ThreadControl
-
- Returns:
- the throwable that caused thread to finish execution
finish
protected void finish(java.lang.Throwable throwable)
-
Method called by thread to release control.
-
-
- Parameters:
throwable - Throwable that caused thread to complete (may be null)
Please see keelframework.org for information about new Keel releases.