com.devexperts.qd.qtp
Class QTPWorkerThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.devexperts.qd.qtp.QTPWorkerThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AbstractConnectionHandler

public abstract class QTPWorkerThread
extends java.lang.Thread

Daemon worker thread that distinguished between being gracefully closed by its parent, or being forcefully interrupted/stopped by someone else.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  com.devexperts.logging.Logging log
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected QTPWorkerThread(java.lang.String name)
           
 
Method Summary
 void close()
          Marks thread as "closed" and interrupts it (if needed).
protected abstract  void doWork()
           
protected abstract  void handleClose(java.lang.Throwable reason)
           
protected abstract  void handleShutdown()
           
 boolean isClosed()
          Returns true if thread is closed and clears interrupt flag.
 void run()
           
 
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
 

Field Detail

log

protected final com.devexperts.logging.Logging log
Constructor Detail

QTPWorkerThread

protected QTPWorkerThread(java.lang.String name)
Method Detail

close

public final void close()
Marks thread as "closed" and interrupts it (if needed).


isClosed

public final boolean isClosed()
                       throws java.lang.InterruptedException
Returns true if thread is closed and clears interrupt flag.

Returns:
true if thread is closed and clears interrupt flag
Throws:
java.lang.InterruptedException - if thread is interrupted without call to close().

run

public final void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

doWork

protected abstract void doWork()
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

handleShutdown

protected abstract void handleShutdown()

handleClose

protected abstract void handleClose(java.lang.Throwable reason)