org.mmbase.core.util
Class DaemonThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.mmbase.core.util.DaemonThread
All Implemented Interfaces:
Runnable, DaemonTask

Deprecated. This class copies functionality present in e.g. java.util.concurrent.ScheduledThreadPoolExecutor (a thread pool which can be used is e.g. ThreadPools.scheduler). If scheduling is not used, then only the thread group is special, which can just as well be obtained by MMBaseContext.getThreadGroup().

public class DaemonThread
extends Thread
implements DaemonTask

Defines a daemon thread that runs in the threadgroup belonging to this MMBase context.

Since:
MMBase-1.8
Version:
$Id: DaemonThread.java 41174 2010-02-25 22:14:09Z michiel $
Author:
Pierre van Rooden

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_SLEEP_PERIOD
          Deprecated. Default sleep period for a daemon thread (one minute).
protected  int sleepPeriod
          Deprecated. The threads sleep period.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DaemonThread()
          Deprecated. Create a MMBase daemon thread (associated with this MMBase's threadgroup).
DaemonThread(Runnable target, String name)
          Deprecated. Create a MMBase daemon thread (associated with this MMBase's threadgroup).
DaemonThread(String name)
          Deprecated. Create a MMBase daemon thread (associated with this MMBase's threadgroup).
 
Method Summary
 void executeTask()
          Deprecated. Defines a task that need be run by a daemon thread's run() method.
 int getSleepPeriod()
          Deprecated. Returns this task's sleep period.
 DaemonTask getTask()
          Deprecated. Returns the task this thread runs when started.
 void interrupt()
          Deprecated.  
 boolean isRunning()
          Deprecated.  
 void run()
          Deprecated. Default behavior (when no target is specified) is to run continuously until interrupted.
 void setTask(DaemonTask task)
          Deprecated. Sets the task this thread should run when started.
 void start()
          Deprecated.  
 
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, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SLEEP_PERIOD

public static final int DEFAULT_SLEEP_PERIOD
Deprecated. 
Default sleep period for a daemon thread (one minute).

See Also:
Constant Field Values

sleepPeriod

protected int sleepPeriod
Deprecated. 
The threads sleep period. This period is used when a Daemonthread runs on its own (that is, without an assigned task) When a DaemonThread is assigned a task, it uses the sleep period of that task.

Constructor Detail

DaemonThread

public DaemonThread()
Deprecated. 
Create a MMBase daemon thread (associated with this MMBase's threadgroup).


DaemonThread

public DaemonThread(String name)
Deprecated. 
Create a MMBase daemon thread (associated with this MMBase's threadgroup).

Parameters:
name - the name of the thread

DaemonThread

public DaemonThread(Runnable target,
                    String name)
Deprecated. 
Create a MMBase daemon thread (associated with this MMBase's threadgroup).

Parameters:
target - the target thread
name - the name of the thread
Method Detail

setTask

public void setTask(DaemonTask task)
Deprecated. 
Sets the task this thread should run when started.

Parameters:
task - the task to run

getTask

public DaemonTask getTask()
Deprecated. 
Returns the task this thread runs when started.


getSleepPeriod

public int getSleepPeriod()
Deprecated. 
Description copied from interface: DaemonTask
Returns this task's sleep period.

Specified by:
getSleepPeriod in interface DaemonTask

start

public void start()
Deprecated. 
Overrides:
start in class Thread

interrupt

public void interrupt()
Deprecated. 
Overrides:
interrupt in class Thread

isRunning

public boolean isRunning()
Deprecated. 

executeTask

public void executeTask()
Deprecated. 
Description copied from interface: DaemonTask
Defines a task that need be run by a daemon thread's run() method.

Specified by:
executeTask in interface DaemonTask

run

public void run()
Deprecated. 
Default behavior (when no target is specified) is to run continuously until interrupted.

Specified by:
run in interface Runnable
Overrides:
run in class Thread


MMBase 2.0-SNAPSHOT - null