Class EventServiceBase<T>

Type Parameters:
T - The type of the event.
All Implemented Interfaces:
Runnable, ArooaContextAware, ArooaSessionAware, Outbound<T>, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful, Stoppable
Direct Known Subclasses:
EventWatchComponent, ForEvents, ListSource, StreamWatcher

public abstract class EventServiceBase<T> extends BasePrimary implements Outbound<T>, Runnable, Resettable, Stateful, Stoppable
Base class for components that want Event Icons because the objects the emmit are in the style of events rather than streams of data. Implementations can either be used in BasicBusService or as EventSources using an EventSourceAdaptor as happens automatically in EventJobBase.

Implementations need only implement doStart(Consumer).

  • Constructor Details

    • EventServiceBase

      public EventServiceBase()
      Constructor.
  • Method Details

    • stateHandler

      protected EventStateHandler stateHandler()
      Description copied from class: BaseComponent
      Subclasses must provide a StateHandler.
      Specified by:
      stateHandler in class BaseComponent
      Returns:
      A State Handler. Never null.
    • iconHelper

      protected IconHelper iconHelper()
      Description copied from class: BaseComponent
      Subclasses must provide a IconHelper.
      Specified by:
      iconHelper in class BaseComponent
      Returns:
      An Icon Helper. Never null.
    • getStateChanger

      protected final StateChanger<EventState> getStateChanger()
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • setStateException

      protected void setStateException(Throwable e)
    • doStart

      protected abstract Restore doStart(Consumer<? super T> consumer) throws Exception
      Throws:
      Exception
    • stop

      public final void stop()
      Allow subclasses to indicate they are stopping. The subclass must still implement Stoppable.
      Specified by:
      stop in interface Stoppable
    • softReset

      public boolean softReset()
      Description copied from interface: Resettable
      Perform a soft reset.
      Specified by:
      softReset in interface Resettable
      Returns:
      true if successful.
    • hardReset

      public boolean hardReset()
      Description copied from interface: Resettable
      Perform a hard reset.
      Specified by:
      hardReset in interface Resettable
      Returns:
      true if successful.
    • onSoftReset

      protected void onSoftReset()
      Allow subclasses to do something on a soft reset. Defaults to onReset()
    • onHardReset

      protected void onHardReset()
      Allow sub classes to do something on a hard reset. Defaults to onReset()
    • onReset

      protected void onReset()
      Allow sub classes to do something on reset.
    • setTo

      public void setTo(Consumer<? super T> destination)
      Description copied from interface: Outbound
      Set the out bound destination.
      Specified by:
      setTo in interface Outbound<T>
      Parameters:
      destination -
    • fireDestroyedState

      protected void fireDestroyedState()
      Internal method to fire state.
      Specified by:
      fireDestroyedState in class BaseComponent