|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectconsciouscode.seedling.tree.GenericNode
consciouscode.seedling.tasks.AbstractPeriodicTask
public abstract class AbstractPeriodicTask
Interface for tasks that can be scheduled for execution by a Clock
.
By default, instances of this class have periods of 60 seconds and are
started immediately.
Field Summary | |
---|---|
static int |
MILLIS_PER_MINUTE
|
static int |
MILLIS_PER_SECOND
|
Constructor Summary | |
---|---|
AbstractPeriodicTask()
|
Method Summary | |
---|---|
Clock |
getClock()
|
long |
getPeriodMillis()
Get the amount of time, in milliseconds, between executions of this task. |
boolean |
isStartedImmediately()
Determine whether this task should be started immediately when it's added to a clock. |
void |
setClock(Clock clock)
|
void |
setPeriodMillis(long millis)
|
void |
setPeriodMinutes(int minutes)
|
void |
setPeriodSeconds(int seconds)
|
void |
setStartedImmediately(boolean start)
|
void |
startService()
Starts a Seedling service. |
void |
stopService()
Stops a Seedling service. |
Methods inherited from class consciouscode.seedling.tree.GenericNode |
---|
getLocalRoot, getLog, getNodeLocation, getNodeName, getParentBranch, isLoggingDebug, nodeInstalled, setLog, setLoggingDebug |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
public static final int MILLIS_PER_SECOND
public static final int MILLIS_PER_MINUTE
Constructor Detail |
---|
public AbstractPeriodicTask()
Method Detail |
---|
public long getPeriodMillis()
getPeriodMillis
in interface PeriodicTask
public void setPeriodMillis(long millis)
public void setPeriodSeconds(int seconds)
public void setPeriodMinutes(int minutes)
public boolean isStartedImmediately()
isStartedImmediately
in interface PeriodicTask
public void setStartedImmediately(boolean start)
public Clock getClock()
public void setClock(Clock clock)
public void startService()
ServiceNode
RuntimeException
are propagated
to the application, but any other kind of exception is wrapped in a
ServiceException
and rethrown.
startService
in interface ServiceNode
public void stopService()
ServiceNode
Implementations of this method must not do anything that may change
the state of the parent Seedling. In particular, it cannot call
any overload of the following methods:
BranchNode.getNode(java.lang.String)
,
BranchNode.getChild(java.lang.String)
, GrowingBranch.installChild(java.lang.String, java.lang.Object)
,
GrowingBranch.uninstallChild(java.lang.String)
.
Furthermore, this method may be called from within a JVM shutdown hook, which implies that it must work promptly and carefully.
stopService
in interface ServiceNode
Runtime.addShutdownHook(java.lang.Thread)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |