Package com.icegreen.greenmail.util
Interface Service
-
- All Known Implementing Classes:
AbstractServer,ImapServer,Pop3Server,SmtpServer
public interface ServiceGeneric lifecycle handling of a service. Used by email protocol specific services, such as SmtpServer.- Since:
- 2005
- Author:
- Wael Chatila
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisRunning()Checks if service is up and running.voidstartService()Starts the service in the background as a new thread.voidstopService()Stops the service.voidstopService(long timeoutInMs)Stops the service.booleanwaitTillRunning(long timeoutInMs)Waits till service is up or timeout was reached.
-
-
-
Method Detail
-
startService
void startService()
Starts the service in the background as a new thread. You can useisRunning()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
boolean waitTillRunning(long timeoutInMs) throws InterruptedExceptionWaits 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.
-
-