Class RequestProducerBase<T extends OutgoingMessage>

java.lang.Object
com.sportradar.livedata.sdk.proto.common.RequestProducerBase<T>
Type Parameters:
T - The type of the requests produced by the current RequestProducerBase
All Implemented Interfaces:
RequestProducer<T>
Direct Known Subclasses:
LiveScoutClientAliveProducer, LiveScoutUserRequestManagerImpl, RequestProducerComposite

public abstract class RequestProducerBase<T extends OutgoingMessage> extends Object implements RequestProducer<T>
A base class for all classes implementing RequestProducer interface.
  • Constructor Details

    • RequestProducerBase

      public RequestProducerBase()
  • Method Details

    • setListener

      public final void setListener(RequestProducerListener<T> listener)
      Sets the RequestProducerListener used to observe the current RequestProducer
      Specified by:
      setListener in interface RequestProducer<T extends OutgoingMessage>
      Parameters:
      listener - The listener used to observer the current RequestProducer
    • start

      public final void start()
      Instructs the RequestProducer to start generating requests.
      Specified by:
      start in interface RequestProducer<T extends OutgoingMessage>
    • onStarting

      protected void onStarting()
      Invoked by the current RequestProducerBase when it is starting. Note that the method is called within critical region, so make sure the execution does not leave the derived class.
    • stop

      public final void stop()
      Instructs the RequestProducer to stop generating requests;
      Specified by:
      stop in interface RequestProducer<T extends OutgoingMessage>
    • onStopping

      protected void onStopping()
      Invoked by the current RequestProducerBase when it is stopping. Note that the method is called withing critical region, so make sure the execution does not leave the derived class.
    • getIsStarted

      protected boolean getIsStarted()
      Gets the value specifying whether the current RequestProducerBase is started.
      Returns:
      the value specifying whether the current RequestProducerBase is started.
    • notifyOnRequestReady

      protected boolean notifyOnRequestReady(T message)
    • notifyOnRequestReady

      protected boolean notifyOnRequestReady(T message, boolean blocking)
      Notifies the observer that new request is ready to be send to the server.
      Parameters:
      message - the T representing the request to be send to the betradar server.
      blocking - determine if request must be blocking.
      Returns:
      true is success.