public interface Service
Modifier and Type | Method and Description |
---|---|
boolean |
hasStopped()
Call to check if the service has been stopped (and thus can no longer be used).
|
boolean |
isRunning()
Call to check if the service has been started, and not shutdown yet.
|
void |
start()
Starts the service, blocking until the service is running.
|
boolean |
startIfNotStarted()
Starts the service if it has not already been started.
|
void |
stop()
Stops the service, blocking until the service is shutdown.
|
boolean |
stopIfRunning()
Stops the service if it currently running.
|
void start() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- thrown if the service has already been startedboolean startIfNotStarted()
false
). If this call starts the service
the thread will block until the service is running.true
if the service has been started from this callvoid stop()
java.lang.IllegalStateException
- thrown if the service has never been started, or is already shutdownboolean stopIfRunning()
false
). If this call stops
the service the thread will block until the service is shutdown.true
if the service has been stopped from this callboolean isRunning()
hasStopped()
.true
if the service is currently runningboolean hasStopped()
isRunning()
in that it will return false
until
stop()
or stopIfRunning()
has been invoked. Thus allowing you to make a
check that's state will be consistent when it is new and while it is running.true
if the server has been stopped