Class LiveScoutDisruptorDispatcher
- java.lang.Object
-
- com.sportradar.livedata.sdk.dispatch.DisruptorDispatcher<LiveScoutDispatcherContainer>
-
- com.sportradar.livedata.sdk.dispatch.livescout.LiveScoutDisruptorDispatcher
-
- All Implemented Interfaces:
LiveFeedDispatcher<LiveScoutFeed>
,LiveScoutDispatcher
public class LiveScoutDisruptorDispatcher extends DisruptorDispatcher<LiveScoutDispatcherContainer> implements LiveScoutDispatcher
ALiveScoutDispatcher
implementation which uses disruptor to dispatch messages on multiple threads
-
-
Field Summary
-
Fields inherited from class com.sportradar.livedata.sdk.dispatch.DisruptorDispatcher
dispatcherCount, dispatcherQueueSize, halfDispatcherQueueSize, sdkLogger
-
-
Constructor Summary
Constructors Constructor Description LiveScoutDisruptorDispatcher(int dispatcherCount, int dispatcherQueueSize, ExecutorService executor, LiveScoutStatisticsCounter counter)
Initializes a new instance of theLiveScoutDisruptorDispatcher
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.lmax.disruptor.EventHandler<LiveScoutDispatcherContainer>[]
buildConsumers()
Constructs and returns an array ofEventHandler
instances representing disruptor dispatchers.void
dispatchEntity(LiveScoutEntityBase entity)
Dispatches the passedLiveScoutEntityBase
to the uservoid
dispatchOnClosed(LiveScoutFeed sender)
void
dispatchOnFeedEvent(LiveScoutFeed sender, FeedEventType eventType)
void
dispatchOnInitialized(LiveScoutFeed sender)
void
dispatchOnOpened(LiveScoutFeed sender)
void
setFeed(LiveScoutFeed feed)
Set the feed.void
start(LiveScoutFeedListener listener)
Starts the currentLiveScoutDispatcher
void
stop()
Stops the currentLiveScoutDispatcher
and disposed any resources associated with it.-
Methods inherited from class com.sportradar.livedata.sdk.dispatch.DisruptorDispatcher
publish, startDisruptor, stopDisruptor
-
-
-
-
Constructor Detail
-
LiveScoutDisruptorDispatcher
public LiveScoutDisruptorDispatcher(int dispatcherCount, int dispatcherQueueSize, ExecutorService executor, LiveScoutStatisticsCounter counter)
Initializes a new instance of theLiveScoutDisruptorDispatcher
class.- Parameters:
dispatcherCount
- The number of the consumers which dispatch events to the user.dispatcherQueueSize
- The size of the disruptor.executor
- TheExecutorService
used to spawn background threadscounter
- TheLiveScoutStatisticsCounter
event counter used as JMX MBeans
-
-
Method Detail
-
dispatchOnClosed
public void dispatchOnClosed(LiveScoutFeed sender)
- Specified by:
dispatchOnClosed
in interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnFeedEvent
public void dispatchOnFeedEvent(LiveScoutFeed sender, FeedEventType eventType)
- Specified by:
dispatchOnFeedEvent
in interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnInitialized
public void dispatchOnInitialized(LiveScoutFeed sender)
- Specified by:
dispatchOnInitialized
in interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnOpened
public void dispatchOnOpened(LiveScoutFeed sender)
- Specified by:
dispatchOnOpened
in interfaceLiveFeedDispatcher<LiveScoutFeed>
-
start
public void start(LiveScoutFeedListener listener)
Starts the currentLiveScoutDispatcher
- Specified by:
start
in interfaceLiveScoutDispatcher
- Parameters:
listener
- TheLiveScoutFeedListener
used by the currentLiveScoutFeedListener
to dispatch events
-
stop
public void stop()
Stops the currentLiveScoutDispatcher
and disposed any resources associated with it.- Specified by:
stop
in interfaceLiveScoutDispatcher
-
dispatchEntity
public void dispatchEntity(LiveScoutEntityBase entity) throws com.lmax.disruptor.InsufficientCapacityException
Dispatches the passedLiveScoutEntityBase
to the user- Specified by:
dispatchEntity
in interfaceLiveScoutDispatcher
- Parameters:
entity
- theLiveScoutEntityBase
to dispatch to the user.- Throws:
com.lmax.disruptor.InsufficientCapacityException
- ring buffer is full.
-
setFeed
public void setFeed(LiveScoutFeed feed)
Set the feed.- Specified by:
setFeed
in interfaceLiveScoutDispatcher
- Parameters:
feed
- feed that will be served.
-
buildConsumers
protected com.lmax.disruptor.EventHandler<LiveScoutDispatcherContainer>[] buildConsumers()
Constructs and returns an array ofEventHandler
instances representing disruptor dispatchers.- Specified by:
buildConsumers
in classDisruptorDispatcher<LiveScoutDispatcherContainer>
- Returns:
- an array of
EventHandler
instances representing disruptor dispatchers.
-
-