| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.boylesoftware.cb2.util.pool.PooledThread
Abstract parent class for threads to be used with
 PooledThreadFactory class. The thread sleeps most
 of the time and calling doExecute method from another
 thread triggers the user-implemented execute method
 call from within the pooled thread. After the execute
 method returns the thread returns itself to the pool and goes into
 the sleep mode again.
 
Note, you should not return the thread back to the pool, it
 does it automatically after the user-defined execute
 method returns.
 
The two thread control methods, doExecute and
 kill should only be called on instances just taken
 from the pool. That is you call get method on the pool
 to get an instance and then call one of the control methods once.
| Constructor Summary | |
| PooledThread() | |
| Method Summary | |
|  void | doExecute()Triggers the user-defined executemethod call. | 
| protected abstract  void | execute()Define this method and implement the thread's logic in it. | 
|  void | kill()Kills the thread. | 
|  void | run()The thread enrty point. | 
|  void | setPool(AdaptiveObjectPool pool)This method is automatically called from the factory, it sets the internal reference to the pool so this implementation can return objects after execution. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public PooledThread()
| Method Detail | 
public final void setPool(AdaptiveObjectPool pool)
pool - reference to the pool this thread belongs to.public final void run()
run in interface java.lang.Runnablepublic final void doExecute()
execute method call. Note,
 that this method does nothing if the thread is already in the
 user-defined execute.
public final void kill()
execute method it will not be destroyed until the
 execute method finishes and returns. Note, that
 you should call this method only on instances just returned from
 the pool (the get method on the pool) and never
 immediately after doExecute call.
protected abstract void execute()
doExecute
 triggering method is called from another thread.
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||