org.mortbay.util
Class LifeCycleThread

java.lang.Object
  |
  +--org.mortbay.util.LifeCycleThread
All Implemented Interfaces:
LifeCycle, java.lang.Runnable

public abstract class LifeCycleThread
extends java.lang.Object
implements LifeCycle, java.lang.Runnable

Base Thread class implementing LifeCycle.

Version:
$Revision: 1.1 $
Author:
Greg Wilkins (gregw)

Constructor Summary
LifeCycleThread()
           
 
Method Summary
 void destroy()
          Destroy the LifeCycle.
 boolean error(java.lang.Error e)
          Handle error from loop.
 boolean exception(java.lang.Exception e)
          Handle exception from loop.
 boolean isDaemon()
           
 boolean isDestroyed()
           
 boolean isStarted()
           
abstract  void loop()
           
 void run()
           
 void setDaemon(boolean d)
           
 void start()
          Start the LifeCycle.
 void stop()
          Stop the LifeCycle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifeCycleThread

public LifeCycleThread()
Method Detail

isDaemon

public boolean isDaemon()
Returns:
 

setDaemon

public void setDaemon(boolean d)
Parameters:
d -  

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle
Returns:
 

isDestroyed

public boolean isDestroyed()
Specified by:
isDestroyed in interface LifeCycle
Returns:
 

start

public void start()
           throws java.lang.Exception
Description copied from interface: LifeCycle
Start the LifeCycle.
Specified by:
start in interface LifeCycle
Following copied from interface: org.mortbay.util.LifeCycle
Throws:
java.lang.Exception - An arbitrary exception may be thrown.

stop

public void stop()
          throws java.lang.InterruptedException
Description copied from interface: LifeCycle
Stop the LifeCycle. The LifeCycle may wait for current activities to complete normally, but it can be interrupted.
Specified by:
stop in interface LifeCycle

destroy

public void destroy()
Description copied from interface: LifeCycle
Destroy the LifeCycle. Activities are terminated.
Specified by:
destroy in interface LifeCycle

run

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

exception

public boolean exception(java.lang.Exception e)
Handle exception from loop.
Parameters:
e - The exception
Returns:
True of the loop should continue;

error

public boolean error(java.lang.Error e)
Handle error from loop.
Parameters:
e - The exception
Returns:
True of the loop should continue;

loop

public abstract void loop()
                   throws java.lang.InterruptedException,
                          java.io.InterruptedIOException,
                          java.lang.Exception
Throws:
java.lang.InterruptedException -  
java.io.InterruptedIOException -  


Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.