public interface ServiceThreadHandling
ADEPT2Service does not allow access
from the outside while not running. However, the thread initialising and
shutting down needs to access the service. This can be achieved using this
interface.| Modifier and Type | Method and Description |
|---|---|
boolean |
privilegeThread()
Stores the current thread as privileged when the service has not been
started or is currently shut down.
|
void |
signalShutdown(boolean emergency)
Privileges the current thread, sets the shutdown flag and in case of
emergency interrupts all active threads without the privileged ones since
they are shutting down this service.
|
void |
signalStart()
Signals the successful start by counting down the latch and removing
privileged threads.
|
void |
unprivilegeThread()
Revokes the privileges of the current thread that is, it may not access the
service any more in case it is not started or currently shut down.
|
boolean privilegeThread()
unprivileging them again.
The thread running the constructor and the thread signalling the shutdown is implicitly privileged.
false will be
returned and the caller must not unprivilege the thread.void unprivilegeThread()
void signalStart()
void signalShutdown(boolean emergency)
emergency - Flag whether this is an emergency shutdown and the active
sessions should be interrupted.