Interface ServiceEnvironment


public interface ServiceEnvironment
This interface represents a service environment. It allows communication between a service and its environment.
Author:
Maja Pesic
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    A service uses this method to signal that it has been canceled (i.e., the socket is closed).
    boolean
    Provides the information about the state of the environment.
    void
    log(String message)
    A service uses this method to log messages in the environment.
    void
    log(String message, Logger.MessageLevel level)
    A service uses this method to log messages in the environment.
    void
    A service uses this method to log occurrence of an exception in the environment.
    void
    While listening on its socket, a service will regularly invoke this method.
  • Method Details

    • 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(String message, Logger.MessageLevel level)
      A service uses this method to log messages in the environment.
      Parameters:
      message - is the message that should be logged
      level - is the type of message
    • log

      void log(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(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).