public class PreferenceQueueService extends java.lang.Object implements LifecycleQueueService
ASYNCHRONOUS_QUEUE_MODE, GLOABL_QUEUE_SCOPE, PREFERENCE_QUEUE_MODE, QUEUE_MODE_PROPERTY, QUEUE_SCOPE_PROPERTY, SYNCHRONOUS_QUEUE_MODE
Constructor and Description |
---|
PreferenceQueueService(PreferenceSelection strategy,
LifecycleQueueService syncQueue,
LifecycleQueueService asyncQueue)
Creates the preference queue service.
|
Modifier and Type | Method and Description |
---|---|
void |
addQueueListener(QueueListener listener)
Add a
QueueListener that will be notified on events relative to this QueueService . |
int |
getCurrents() |
int |
getFinished() |
int |
getWaiters() |
java.util.List<JobInfo> |
getWaitersInfo()
Gets the number of waiting job.
|
void |
removeQueueListener(QueueListener listener)
Remove a
QueueListener from this QueueService . |
void |
start()
Starting queues.
|
void |
stop()
Stopping queues.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable)
Submits a job to the queue service.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable,
Callback<T> callback,
java.lang.String description)
Submits a job to the right queue.
|
<T> java.util.concurrent.Future<T> |
submit(Job<T> callable,
java.lang.String description)
Submits a job to the queue service.
|
public PreferenceQueueService(PreferenceSelection strategy, LifecycleQueueService syncQueue, LifecycleQueueService asyncQueue)
strategy
- the preference strategysyncQueue
- the synchronous queue serviceasyncQueue
- the asynchronous queue servicepublic int getFinished()
getFinished
in interface QueueService
public int getWaiters()
getWaiters
in interface QueueService
public int getCurrents()
getCurrents
in interface QueueService
public java.util.List<JobInfo> getWaitersInfo()
getWaitersInfo
in interface QueueService
public <T> java.util.concurrent.Future<T> submit(Job<T> callable, Callback<T> callback, java.lang.String description)
submit
in interface QueueService
callable
- the jobcallback
- callback called when the job is processeddescription
- a description of the jobpublic <T> java.util.concurrent.Future<T> submit(Job<T> callable, java.lang.String description)
QueueService
submit
in interface QueueService
callable
- the jobdescription
- a description of the jobpublic <T> java.util.concurrent.Future<T> submit(Job<T> callable)
QueueService
submit
in interface QueueService
callable
- the jobpublic void addQueueListener(QueueListener listener)
QueueService
QueueListener
that will be notified on events relative to this QueueService
.addQueueListener
in interface QueueService
listener
- added listenerpublic void removeQueueListener(QueueListener listener)
QueueService
QueueListener
from this QueueService
.removeQueueListener
in interface QueueService
listener
- removed listenerCopyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.