/**
* Create the task scheduler.
* @return the task scheduler.
*/
public static TaskScheduler getTaskScheduler() {
TaskScheduler taskScheduler = taskSchedulerRef.get();
if (taskScheduler == null) {
taskScheduler = new TaskScheduler();
if (!taskSchedulerRef.compareAndSet(null, taskScheduler)) {
taskScheduler = taskSchedulerRef.get();
} else {
taskScheduler.start();
}
}
return taskScheduler;
}