Class Service

java.lang.Object
com.framed.core.Service
Direct Known Subclasses:
Actor, Dispatcher, Parser, Protocol, Writer

public abstract class Service extends Object
An abstract base class for application services that provides access to an EventBus for inter-component communication / services and a Logger for logging.

Subclasses can use the event bus to send or receive messages and the logger for diagnostic output. This class also provides a default stop() method that can be overridden to implement custom shutdown logic.

  • Field Details

    • eventBus

      protected EventBus eventBus
      The event bus used for communication between components.
    • logger

      protected final Logger logger
      Logger instance for this service, initialized with the class name.
    • formatter

      protected static final DateTimeFormatter formatter
  • Constructor Details

    • Service

      protected Service(EventBus eventBus)
      Creates a new service instance with the specified event bus.
      Parameters:
      eventBus - the event bus used for communication
  • Method Details

    • stop

      public void stop()
      Stops the service.

      By default, this method logs a message indicating that no stop logic is implemented. Subclasses should override this method to provide custom shutdown behavior when necessary.