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 booleanGets the value specifying whether the currentRequestProducerBaseis started.protected booleannotifyOnRequestReady(T message) protected booleannotifyOnRequestReady(T message, boolean blocking) Notifies the observer that new request is ready to be send to the server.protected voidInvoked by the currentRequestProducerBasewhen it is starting.protected voidInvoked by the currentRequestProducerBasewhen it is stopping.final voidsetListener(RequestProducerListener<T> listener) Sets theRequestProducerListenerused to observe the currentRequestProducerfinal voidstart()Instructs theRequestProducerto start generating requests.final voidstop()Instructs theRequestProducerto stop generating requests;
-
Constructor Details
-
RequestProducerBase
public RequestProducerBase()
-
-
Method Details
-
setListener
Sets theRequestProducerListenerused to observe the currentRequestProducer- Specified by:
setListenerin interfaceRequestProducer<T extends OutgoingMessage>- Parameters:
listener- The listener used to observer the currentRequestProducer
-
start
public final void start()Instructs theRequestProducerto start generating requests.- Specified by:
startin interfaceRequestProducer<T extends OutgoingMessage>
-
onStarting
protected void onStarting()Invoked by the currentRequestProducerBasewhen 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 theRequestProducerto stop generating requests;- Specified by:
stopin interfaceRequestProducer<T extends OutgoingMessage>
-
onStopping
protected void onStopping()Invoked by the currentRequestProducerBasewhen 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 currentRequestProducerBaseis started.- Returns:
- the value specifying whether the current
RequestProducerBaseis started.
-
notifyOnRequestReady
-
notifyOnRequestReady
Notifies the observer that new request is ready to be send to the server.- Parameters:
message- theTrepresenting the request to be send to the betradar server.blocking- determine if request must be blocking.- Returns:
- true is success.
-