Class SdkTaskSchedulerImpl
java.lang.Object
com.sportradar.unifiedodds.sdk.internal.impl.SdkTaskSchedulerImpl
- All Implemented Interfaces:
SdkTaskScheduler
The main SDK task scheduler
-
Constructor Summary
ConstructorsConstructorDescriptionSdkTaskSchedulerImpl(ScheduledExecutorService scheduler, SdkInternalConfiguration sdkInternalConfiguration) Constructs a new sdk task scheduler -
Method Summary
Modifier and TypeMethodDescriptionvoidopen()Opens the SDK task scheduler and starts all the scheduled tasksvoidscheduleAtFixedRate(String name, Runnable command, long initialDelay, long period, TimeUnit unit) Schedules a repeating task.voidShuts down all the scheduled tasksvoidstartOneTimeTask(String name, Runnable command) Creates and executes a one-shot action
-
Constructor Details
-
SdkTaskSchedulerImpl
public SdkTaskSchedulerImpl(ScheduledExecutorService scheduler, SdkInternalConfiguration sdkInternalConfiguration) Constructs a new sdk task scheduler- Parameters:
scheduler- the actualScheduledExecutorServiceinstance which will be used to schedule taskssdkInternalConfiguration- the internal SDK configuration
-
-
Method Details
-
open
public void open()Opens the SDK task scheduler and starts all the scheduled tasks- Specified by:
openin interfaceSdkTaskScheduler
-
shutdownNow
public void shutdownNow()Shuts down all the scheduled tasks- Specified by:
shutdownNowin interfaceSdkTaskScheduler
-
scheduleAtFixedRate
public void scheduleAtFixedRate(String name, Runnable command, long initialDelay, long period, TimeUnit unit) Schedules a repeating task. If the instance is closed, the task will be stored and started only once the intance has been opened withopen()- Specified by:
scheduleAtFixedRatein interfaceSdkTaskScheduler- Parameters:
name- the associated task namecommand- seeScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)initialDelay- seeScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)period- seeScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)unit- seeScheduledExecutorService.scheduleAtFixedRate(Runnable, long, long, TimeUnit)
-
startOneTimeTask
Creates and executes a one-shot action- Specified by:
startOneTimeTaskin interfaceSdkTaskScheduler- Parameters:
name- the name of the taskcommand- the task to execute
-