public class ServiceModule extends FrameworkModule
Service
. This class extends the FrameworkModule
with some
additional methods to help with thread execution in a full service extending this module.
The threading can be ignored, or it can be useful for the behaviours.Modifier and Type | Field and Description |
---|---|
protected boolean |
shutDown
True if shutdown the service thread
|
passwordHandler, service, serviceType
jarFile, syncOn, uuid
Constructor and Description |
---|
ServiceModule()
Creates a new instance of ServiceModule.
|
ServiceModule(java.lang.String password,
java.lang.String adminKey)
Creates a new instance of ServiceModule.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getShutDown()
Return the value indicating if this running thread should be shut down.
|
boolean |
interrupt(java.lang.String adminKey)
You must call this method to interrupt the thread.
|
protected void |
setShutDown(boolean thisShutDown)
Set the shut down variable to value passed in.
|
void |
setShutDown(boolean thisShutDown,
java.lang.String adminKey)
Set the shut down variable to value passed in.
|
canAccess, canAccessTemp, getPasswordHandler, getPasswordHandler, getServerPassword, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType
getJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveState
activeCount, checkAccess, clone, 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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getUUID, setJarFile, setUUID
public ServiceModule() throws java.lang.Exception
java.lang.Exception
- any error.public ServiceModule(java.lang.String password, java.lang.String adminKey) throws java.lang.Exception
password
- password to initialise the password handler with.adminKey
- admin key to initialise the password handler with.java.lang.Exception
- any error.public boolean interrupt(java.lang.String adminKey)
adminKey
- the key to identify unique loading of the service.protected void setShutDown(boolean thisShutDown)
thisShutDown
- true if shut down, false if keep running.public void setShutDown(boolean thisShutDown, java.lang.String adminKey)
adminKey
- the service key of this service.thisShutDown
- true if shut down, false if keep running.public boolean getShutDown()