Interface ServiceEnvironment
-
public interface ServiceEnvironmentThis interface represents a service environment. It allows communication between a service and its environment.- Author:
- Maja Pesic
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()A service uses this method to signal that it has been canceled (i.e., the socket is closed).booleanisCancelled()Provides the information about the state of the environment.voidlog(java.lang.String message)A service uses this method to log messages in the environment.voidlog(java.lang.String message, Logger.MessageLevel level)A service uses this method to log messages in the environment.voidlog(java.lang.Throwable t)A service uses this method to log occurrence of an exception in the environment.voidstillAlive()While listening on its socket, a service will regularly invoke this method.
-
-
-
Method Detail
-
isCancelled
boolean isCancelled()
Provides the information about the state of the environment. A service uses this method to decide when to close its socket.- Returns:
- true - if the socket should be closed false - if the service should continue listening on the socket.
-
log
void log(java.lang.String message, Logger.MessageLevel level)A service uses this method to log messages in the environment.- Parameters:
message- is the message that should be loggedlevel- is the type of message
-
log
void log(java.lang.String message)
A service uses this method to log messages in the environment.- Parameters:
message- is the message that should be logged
-
log
void log(java.lang.Throwable t)
A service uses this method to log occurrence of an exception in the environment.- Parameters:
t- is the exception that occurred and should be logged
-
stillAlive
void stillAlive()
While listening on its socket, a service will regularly invoke this method. This method periodically signals to the environment that the service is still listening to its socket.
-
cancel
void cancel()
A service uses this method to signal that it has been canceled (i.e., the socket is closed).
-
-