Package com.icegreen.greenmail.util
Interface Service
- All Known Implementing Classes:
AbstractServer,ImapServer,Pop3Server,SmtpServer
public interface Service
Generic lifecycle handling of a service.
Used by email protocol specific services, such as SmtpServer.
- Since:
- 2005
- Author:
- Wael Chatila
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if service is up and running.voidStarts the service in the background as a new thread.voidStops the service.voidstopService(long timeoutInMs) Stops the service.booleanwaitTillRunning(long timeoutInMs) Waits till service is up or timeout was reached.
-
Method Details
-
startService
void startService()Starts the service in the background as a new thread.You can use
isRunning()andwaitTillRunning(long)to check if service is up. -
stopService
void stopService()Stops the service.Blocks till the service stopped.
-
stopService
void stopService(long timeoutInMs) Stops the service.Blocks till the service stopped.
If a timeout is given and the service has still not gracefully been stopped after timeout ms the service is stopped by force.
- Parameters:
timeoutInMs- the timeout in milliseconds
-
isRunning
boolean isRunning()Checks if service is up and running.- Returns:
- true, if running.
-
waitTillRunning
Waits till service is up or timeout was reached.- Parameters:
timeoutInMs- the timeout in milliseconds- Returns:
- true, if running otherwise false if timeout was reached.
- Throws:
InterruptedException- if interrupted while waiting.
-