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 currentRequestProducerBase
- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Gets the value specifying whether the currentRequestProducerBase
is started.protected boolean
notifyOnRequestReady
(T message) protected boolean
notifyOnRequestReady
(T message, boolean blocking) Notifies the observer that new request is ready to be send to the server.protected void
Invoked by the currentRequestProducerBase
when it is starting.protected void
Invoked by the currentRequestProducerBase
when it is stopping.final void
setListener
(RequestProducerListener<T> listener) Sets theRequestProducerListener
used to observe the currentRequestProducer
final void
start()
Instructs theRequestProducer
to start generating requests.final void
stop()
Instructs theRequestProducer
to stop generating requests;
-
Constructor Details
-
RequestProducerBase
public RequestProducerBase()
-
-
Method Details
-
setListener
Sets theRequestProducerListener
used to observe the currentRequestProducer
- Specified by:
setListener
in interfaceRequestProducer<T extends OutgoingMessage>
- Parameters:
listener
- The listener used to observer the currentRequestProducer
-
start
public final void start()Instructs theRequestProducer
to start generating requests.- Specified by:
start
in interfaceRequestProducer<T extends OutgoingMessage>
-
onStarting
protected void onStarting()Invoked by the currentRequestProducerBase
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 theRequestProducer
to stop generating requests;- Specified by:
stop
in interfaceRequestProducer<T extends OutgoingMessage>
-
onStopping
protected void onStopping()Invoked by the currentRequestProducerBase
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 currentRequestProducerBase
is started.- Returns:
- the value specifying whether the current
RequestProducerBase
is started.
-
notifyOnRequestReady
-
notifyOnRequestReady
Notifies the observer that new request is ready to be send to the server.- Parameters:
message
- theT
representing the request to be send to the betradar server.blocking
- determine if request must be blocking.- Returns:
- true is success.
-