Interface Stateful<S extends Enum>

All Known Subinterfaces:
Endpoint, Node, Service, StateZipper<T,​S>
All Known Implementing Classes:
AbstractDynamicService, AbstractEndpoint, AbstractLazyService, AbstractOnDemandService, AbstractPoolingService, AbstractStateMachine, AbstractStateZipper, AnalyticsEndpoint, AnalyticsService, ConfigEndpoint, ConfigService, CouchbaseNode, EndpointStateZipper, KeyValueEndpoint, KeyValueService, OldAnalyticsService, OldKeyValueService, OldQueryService, OldSearchService, OldViewService, PooledService, QueryEndpoint, QueryService, SearchEndpoint, SearchService, ServiceStateZipper, ViewEndpoint, ViewService

public interface Stateful<S extends Enum>
A stateful component that changes its state and notifies subscribed parties.
Since:
1.0
Author:
Michael Nitschinger
  • Method Summary

    Modifier and Type Method Description
    boolean hasSubscribers()
    Returns true if there are subscribers observing the state stream.
    boolean isState​(S state)
    Check if the given state is the same as the current one.
    S state()
    Returns the current state.
    rx.Observable<S> states()
    Returns a infinite observable which gets updated when the state of the component changes.
  • Method Details

    • states

      rx.Observable<S> states()
      Returns a infinite observable which gets updated when the state of the component changes.
      Returns:
      a Observable updated with state transitions.
    • state

      S state()
      Returns the current state.
      Returns:
      the current state.
    • isState

      boolean isState​(S state)
      Check if the given state is the same as the current one.
      Parameters:
      state - the stats to check against.
      Returns:
      true if it is the same, false otherwise.
    • hasSubscribers

      boolean hasSubscribers()
      Returns true if there are subscribers observing the state stream.
      Returns:
      true if at least one does, false otherwise.