com.icegreen.greenmail.util
Class Service

java.lang.Object
  extended by java.lang.Thread
      extended by com.icegreen.greenmail.util.Service
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
AbstractServer

public abstract class Service
extends Thread

A class that facilitate service implementation

Since:
2005
Version:
$id: $
Author:
Wael Chatila

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Service()
           
 
Method Summary
 void destroy(Object obj)
           
 void init(Object obj)
           
 boolean isRunning()
           
protected  boolean keepOn()
           
abstract  void quit()
           
abstract  void run()
           
protected  void setRunning(boolean r)
           
 void startService(Object obj)
           
 void stopService(Object obj)
           
 void stopService(Object obj, long millis)
           
 void stopService(Object obj, Long millis)
          Stops the service.
 void wait_for_running(long t)
           
 
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
 

Constructor Detail

Service

public Service()
Method Detail

run

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

quit

public abstract void quit()

init

public void init(Object obj)

destroy

public void destroy(Object obj)

keepOn

protected final boolean keepOn()

startService

public void startService(Object obj)

isRunning

public boolean isRunning()

setRunning

protected void setRunning(boolean r)

wait_for_running

public void wait_for_running(long t)
                      throws InterruptedException
Throws:
InterruptedException

stopService

public final void stopService(Object obj,
                              Long millis)
Stops the service. If a timeout is given and the service has still not gracefully been stopped after timeout ms the service is stopped by force.

Parameters:
obj -
millis - value in ms

stopService

public final void stopService(Object obj)

stopService

public final void stopService(Object obj,
                              long millis)