org.sonatype.sisu.goodies.thread
Class ThreadSupport

java.lang.Object
  extended by java.lang.Thread
      extended by org.sonatype.sisu.goodies.thread.ThreadSupport
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
PeriodicThreadSupport, TaskThread

public abstract class ThreadSupport
extends Thread

Support for Thread implementations.

Since:
1.0

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  org.slf4j.Logger log
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected ThreadSupport()
           
protected ThreadSupport(String name)
           
protected ThreadSupport(ThreadGroup group, String name)
           
 
Method Summary
 void cancel()
           
protected  org.slf4j.Logger createLogger()
           
protected abstract  void doRun()
           
protected  void doStop()
           
protected  Mutex getLock()
           
 boolean isCanceled()
           
protected  void onFailure(Throwable cause)
           
 void run()
           
 String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

@NonNls
protected final org.slf4j.Logger log
Constructor Detail

ThreadSupport

protected ThreadSupport()

ThreadSupport

protected ThreadSupport(String name)

ThreadSupport

protected ThreadSupport(ThreadGroup group,
                        String name)
Method Detail

createLogger

protected org.slf4j.Logger createLogger()

cancel

public void cancel()

isCanceled

public boolean isCanceled()

getLock

protected Mutex getLock()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

onFailure

protected void onFailure(Throwable cause)

doRun

protected abstract void doRun()
                       throws Exception
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Thread


Copyright © 2008-2012 Sonatype, Inc.. All Rights Reserved.