Class JobCoordinatorImpl
- java.lang.Object
 - 
- org.opendaylight.infrautils.jobcoordinator.internal.JobCoordinatorImpl
 
 
- 
- All Implemented Interfaces:
 JobCoordinator,JobCoordinatorMonitor
@Singleton public class JobCoordinatorImpl extends Object implements JobCoordinator, JobCoordinatorMonitor
 
- 
- 
Field Summary
- 
Fields inherited from interface org.opendaylight.infrautils.jobcoordinator.JobCoordinator
DEFAULT_MAX_RETRIES 
 - 
 
- 
Constructor Summary
Constructors Constructor Description JobCoordinatorImpl(MetricProvider metricProvider) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voidenqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker)Enqueues a job with DEFAULT_MAX_RETRIES (3) retries.voidenqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, int maxRetries)Enqueues a job with max retries.voidenqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, RollbackCallable rollbackWorker)Enqueues a job with a rollback task and DEFAULT_MAX_RETRIES (3) retries..voidenqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, RollbackCallable rollbackWorker, int maxRetries)Enqueues a job with a rollback task and max retries.longgetClearedTaskCount()Returns the cleared task count.longgetCreatedTaskCount()Returns the created task count.longgetFailedJobCount()Returns the failed jobs count.longgetIncompleteTaskCount()Returns the incomplete task count.protected ThreadgetJobQueueHandlerThread()Map<String,JobQueue>getJobQueueMap()longgetPendingTaskCount()Returns the pending task count.longgetRetriesCount()Returns the retry jobs count.StringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
JobCoordinatorImpl
@Inject public JobCoordinatorImpl(MetricProvider metricProvider)
 
 - 
 
- 
Method Detail
- 
destroy
@PreDestroy public void destroy()
 
- 
enqueueJob
public void enqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker)
Description copied from interface:JobCoordinatorEnqueues a job with DEFAULT_MAX_RETRIES (3) retries. See class level documentation above for details re. the retry strategy.- Specified by:
 enqueueJobin interfaceJobCoordinator- Parameters:
 key- The job's key. Jobs with the same key are run sequentially. Jobs with different keys are run in parallel.mainWorker- The task that runs for the job.
 
- 
enqueueJob
public void enqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, RollbackCallable rollbackWorker)
Description copied from interface:JobCoordinatorEnqueues a job with a rollback task and DEFAULT_MAX_RETRIES (3) retries.. See class level documentation above for details re. the retry strategy.- Specified by:
 enqueueJobin interfaceJobCoordinatorrollbackWorker- The rollback task which runs in case the job's main task fails.- See Also:
 JobCoordinator.enqueueJob(String, Callable)
 
- 
enqueueJob
public void enqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, int maxRetries)
Description copied from interface:JobCoordinatorEnqueues a job with max retries. In case the job's main task fails, it will be retried until it succeeds or the specified maximum number of retries has been reached. See class level documentation above for details re. the retry strategy.- Specified by:
 enqueueJobin interfaceJobCoordinatormaxRetries- The maximum number of retries for the job's main task until it succeeds.- See Also:
 JobCoordinator.enqueueJob(String, Callable)
 
- 
enqueueJob
public void enqueueJob(String key, Callable<List<com.google.common.util.concurrent.ListenableFuture<Void>>> mainWorker, RollbackCallable rollbackWorker, int maxRetries)
Description copied from interface:JobCoordinatorEnqueues a job with a rollback task and max retries. See class level documentation above for details re. the retry strategy.- Specified by:
 enqueueJobin interfaceJobCoordinatorrollbackWorker- The rollback task which runs in case the job's main task fails.maxRetries- The maximum number of retries for the job's main task until it succeeds.- See Also:
 JobCoordinator.enqueueJob(String, Callable, RollbackCallable),JobCoordinator.enqueueJob(String, Callable, int)
 
- 
getClearedTaskCount
public long getClearedTaskCount()
Description copied from interface:JobCoordinatorMonitorReturns the cleared task count.- Specified by:
 getClearedTaskCountin interfaceJobCoordinatorMonitor
 
- 
getCreatedTaskCount
public long getCreatedTaskCount()
Description copied from interface:JobCoordinatorMonitorReturns the created task count.- Specified by:
 getCreatedTaskCountin interfaceJobCoordinatorMonitor
 
- 
getIncompleteTaskCount
public long getIncompleteTaskCount()
Description copied from interface:JobCoordinatorMonitorReturns the incomplete task count.- Specified by:
 getIncompleteTaskCountin interfaceJobCoordinatorMonitor
 
- 
getPendingTaskCount
public long getPendingTaskCount()
Description copied from interface:JobCoordinatorMonitorReturns the pending task count.- Specified by:
 getPendingTaskCountin interfaceJobCoordinatorMonitor
 
- 
getFailedJobCount
public long getFailedJobCount()
Description copied from interface:JobCoordinatorMonitorReturns the failed jobs count.- Specified by:
 getFailedJobCountin interfaceJobCoordinatorMonitor
 
- 
getRetriesCount
public long getRetriesCount()
Description copied from interface:JobCoordinatorMonitorReturns the retry jobs count.- Specified by:
 getRetriesCountin interfaceJobCoordinatorMonitor
 
- 
getJobQueueHandlerThread
protected Thread getJobQueueHandlerThread()
 
- 
toString
public String toString()
- Specified by:
 toStringin interfaceJobCoordinatorMonitor- Overrides:
 toStringin classObject
 
 - 
 
 -