|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
things.thinger.kernel.ThingsProcess
public abstract class ThingsProcess
The abstract base class for all manageable processes. All processes are interruptible, so be sure they catch it.
You will need to implement ProcessInterface and Verbose interfaces.
You should fix() the process first. Then init() it (this will start the thread). Then release() it. At that point, normal state management will work.
Version History
EPG - Adapted - 6 SEP 04 EPG - Added control interface - 26 JUN 05
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_NAME
Constants |
protected RESULT |
internalResult
The internal result. |
protected StringPoster |
myPostLogger
Verbose poster for just Process internal action logging. |
SystemSuperInterface |
ssi
System Super Interface |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
ThingsProcess()
Default Constructor. |
|
| Method Summary | |
|---|---|
void |
acceptHalt()
This will accept the halt if a halt is pending. |
void |
acceptPause()
This thread will accept a pause request. |
abstract void |
constructThingsProcess()
Complete construction. |
abstract void |
destructThingsProcess()
Destroy. |
abstract void |
executeThingsProcess()
This is the entry point for the actual processing. |
protected void |
finalize()
finalizer. |
void |
fix(WhoAmI you)
Fix the process to an ID. |
void |
forceFinalize()
Force finalization. |
void |
forceHalt()
Force halt. |
ThingsState |
getCurrentState()
Get the state. |
int |
getCurrentStateNumeric()
Get the state as a numeric. |
WhoAmI |
getProcessId()
|
abstract java.lang.String |
getProcessName()
Get process name. |
RESULT |
getResult()
Get the latest result. |
long |
getStartTime()
Get start time from epoch. |
ThingsState |
getThingsState()
Get the process state. |
void |
init(SystemSuperInterface theSSI)
Complete initialization. |
boolean |
isVerbose()
Is it set to verbose? |
void |
release()
Release the process for execution. |
void |
releasePause()
Allow it to resume. |
void |
requestHalt()
Request halt. |
boolean |
requestPause()
Request that the process is paused. |
void |
run()
RUN implementation. |
void |
screech(java.lang.String message)
Post a verbose message if verbose mode is on. |
void |
verboseOff()
Turn off the verbose mode. |
void |
verboseOn(StringPoster poster)
Turn on the verbose mode. |
| 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, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface things.thinger.kernel.ResourceListener |
|---|
getListenerId, resourceRevocation, resourceRevoked |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_NAME
public SystemSuperInterface ssi
SystemSuperInterfaceprotected StringPoster myPostLogger
protected RESULT internalResult
| Constructor Detail |
|---|
public ThingsProcess()
| Method Detail |
|---|
public abstract void executeThingsProcess()
throws SystemException,
java.lang.InterruptedException
SystemException
java.lang.InterruptedException
public abstract void constructThingsProcess()
throws SystemException
SystemException
public abstract void destructThingsProcess()
throws SystemException
SystemExceptionpublic abstract java.lang.String getProcessName()
getProcessName in interface ProcessInterface
public final void fix(WhoAmI you)
throws SystemException
you - the kernel imposed ID. The underlying thread will be named by a String representation of this id.
SystemException
public final void init(SystemSuperInterface theSSI)
throws java.lang.Throwable
theSSI - a supersystem interface
throwable
java.lang.Throwable
public final void release()
throws SystemException
SystemExceptionpublic final long getStartTime()
public final WhoAmI getProcessId()
getProcessId in interface ProcessInterface
public ThingsState getThingsState()
throws SystemException
getThingsState in interface ProcessInterfaceSystemException
public boolean requestPause()
throws SystemException
requestPause in interface ProcessInterfaceSystemException
public void releasePause()
throws SystemException
releasePause in interface ProcessInterfaceSystemException
public void requestHalt()
throws SystemException
requestHalt in interface ProcessInterfaceSystemException
public void forceHalt()
throws SystemException
forceHalt in interface ProcessInterfaceSystemException
public RESULT getResult()
throws ThingsException
getResult in interface ProcessInterfaceThingsException - for whatever reason. It may come from the THING itself.
public void acceptPause()
throws SystemException
acceptPause in interface ControlInterfaceSystemException
public void acceptHalt()
throws SystemException
acceptHalt in interface ControlInterfaceSystemExceptionpublic ThingsState getCurrentState()
public int getCurrentStateNumeric()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
public void verboseOn(StringPoster poster)
throws ThingsException
verboseOn in interface Verboseposter - StringPoster where to put the debug info
ThingsExceptionpublic void verboseOff()
verboseOff in interface Verbosepublic void screech(java.lang.String message)
screech in interface Verbosemessage - The message.public boolean isVerbose()
isVerbose in interface Verbose
public void forceFinalize()
throws SystemException
SystemException
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||