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 implementingRequestProducer
interface.
-
-
Constructor Summary
Constructors Constructor Description RequestProducerBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
getIsStarted()
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
onStarting()
Invoked by the currentRequestProducerBase
when it is starting.protected void
onStopping()
Invoked by the currentRequestProducerBase
when it is stopping.void
setListener(RequestProducerListener<T> listener)
Sets theRequestProducerListener
used to observe the currentRequestProducer
void
start()
Instructs theRequestProducer
to start generating requests.void
stop()
Instructs theRequestProducer
to stop generating requests;
-
-
-
Method Detail
-
setListener
public final void setListener(RequestProducerListener<T> listener)
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
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
- theT
representing the request to be send to the betradar server.blocking
- determine if request must be blocking.- Returns:
- true is success.
-
-