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
A
LiveScoutDispatcher 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
ConstructorsConstructorDescriptionLiveScoutDisruptorDispatcher(int dispatcherCount, int dispatcherQueueSize, ExecutorService executor, LiveScoutStatisticsCounter counter) Initializes a new instance of theLiveScoutDisruptorDispatcherclass. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.lmax.disruptor.EventHandler<LiveScoutDispatcherContainer>[]Constructs and returns an array ofEventHandlerinstances representing disruptor dispatchers.voiddispatchEntity(LiveScoutEntityBase entity) Dispatches the passedLiveScoutEntityBaseto the uservoiddispatchOnClosed(LiveScoutFeed sender) voiddispatchOnFeedEvent(LiveScoutFeed sender, FeedEventType eventType) voiddispatchOnInitialized(LiveScoutFeed sender) voiddispatchOnOpened(LiveScoutFeed sender) voidsetFeed(LiveScoutFeed feed) Set the feed.voidstart(LiveScoutFeedListener listener) Starts the currentLiveScoutDispatchervoidstop()Stops the currentLiveScoutDispatcherand disposed any resources associated with it.Methods inherited from class com.sportradar.livedata.sdk.dispatch.DisruptorDispatcher
publish, startDisruptor, stopDisruptor
-
Constructor Details
-
LiveScoutDisruptorDispatcher
public LiveScoutDisruptorDispatcher(int dispatcherCount, int dispatcherQueueSize, ExecutorService executor, LiveScoutStatisticsCounter counter) Initializes a new instance of theLiveScoutDisruptorDispatcherclass.- Parameters:
dispatcherCount- The number of the consumers which dispatch events to the user.dispatcherQueueSize- The size of the disruptor.executor- TheExecutorServiceused to spawn background threadscounter- TheLiveScoutStatisticsCounterevent counter used as JMX MBeans
-
-
Method Details
-
dispatchOnClosed
- Specified by:
dispatchOnClosedin interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnFeedEvent
- Specified by:
dispatchOnFeedEventin interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnInitialized
- Specified by:
dispatchOnInitializedin interfaceLiveFeedDispatcher<LiveScoutFeed>
-
dispatchOnOpened
- Specified by:
dispatchOnOpenedin interfaceLiveFeedDispatcher<LiveScoutFeed>
-
start
Starts the currentLiveScoutDispatcher- Specified by:
startin interfaceLiveScoutDispatcher- Parameters:
listener- TheLiveScoutFeedListenerused by the currentLiveScoutFeedListenerto dispatch events
-
stop
public void stop()Stops the currentLiveScoutDispatcherand disposed any resources associated with it.- Specified by:
stopin interfaceLiveScoutDispatcher
-
dispatchEntity
public void dispatchEntity(LiveScoutEntityBase entity) throws com.lmax.disruptor.InsufficientCapacityException Dispatches the passedLiveScoutEntityBaseto the user- Specified by:
dispatchEntityin interfaceLiveScoutDispatcher- Parameters:
entity- theLiveScoutEntityBaseto dispatch to the user.- Throws:
com.lmax.disruptor.InsufficientCapacityException- ring buffer is full.
-
setFeed
Set the feed.- Specified by:
setFeedin interfaceLiveScoutDispatcher- Parameters:
feed- feed that will be served.
-
buildConsumers
Constructs and returns an array ofEventHandlerinstances representing disruptor dispatchers.- Specified by:
buildConsumersin classDisruptorDispatcher<LiveScoutDispatcherContainer>- Returns:
- an array of
EventHandlerinstances representing disruptor dispatchers.
-