public class DefaultTaskQueueManager extends Object implements TaskQueueManager
| Constructor and Description |
|---|
DefaultTaskQueueManager(com.spikeify.Spikeify spikeify,
TaskQueueService queueService) |
| Modifier and Type | Method and Description |
|---|---|
void |
check()
Should be called on regular basis from each machine running queues
takes care that if one instance has started/stopped a queue it is also started/stopped on other machines
|
QueueInfo |
disable(String queueName)
Disables queue - stops queue if running
|
QueueInfo |
enable(String queueName)
Enables queue
|
QueueInfo |
info(String queueName)
Returns single queue info with statistics
|
boolean |
isRunning(String queueName) |
List<QueueInfo> |
list(Boolean active)
Lists queues registered
|
QueueInfo |
register(String queueName,
boolean autoStart)
Registers queue to be monitored
|
void |
resetStatistics(String queueName)
Will reset all statistics data and counts
|
void |
set(String queueName,
QueueSettings settings)
Sets queue settings
|
void |
start(String... queueNames)
Starts queues ...
|
void |
stop(String... queueNames)
Stops queues - stops all running tasks/threads (on given JVM)
|
protected void |
stopRunningThreads(String queueName) |
void |
unregister(String queueName)
Removes queue from monitoring
|
public static final Logger log
public DefaultTaskQueueManager(com.spikeify.Spikeify spikeify,
TaskQueueService queueService)
public QueueInfo register(String queueName, boolean autoStart)
TaskQueueManagerregister in interface TaskQueueManagerqueueName - name of queueautoStart - true will put queue into started mode (once check is called queue will be started), false queue must be put into started mode manuallypublic QueueInfo info(String queueName)
TaskQueueManagerinfo in interface TaskQueueManagerqueueName - name of queuepublic void resetStatistics(String queueName)
TaskQueueManagerresetStatistics in interface TaskQueueManagerqueueName - name of queuepublic List<QueueInfo> list(Boolean active)
TaskQueueManagerlist in interface TaskQueueManageractive - - true list active queues, false - list disabled queues, null - list allpublic void unregister(String queueName)
TaskQueueManagerunregister in interface TaskQueueManagerqueueName - to be removedpublic void start(String... queueNames) throws InterruptedException
TaskQueueManagerstart in interface TaskQueueManagerqueueNames - names to be started or empty to start all enabled queuesInterruptedException - when interruptedpublic void stop(String... queueNames) throws InterruptedException
TaskQueueManagerstop in interface TaskQueueManagerqueueNames - to be stopped or empty to stop all enabled queuesInterruptedException - when interruptedpublic boolean isRunning(String queueName)
isRunning in interface TaskQueueManagerqueueName - name of queuepublic QueueInfo enable(String queueName)
TaskQueueManagerenable in interface TaskQueueManagerqueueName - - enables queue to be runpublic QueueInfo disable(String queueName)
TaskQueueManagerdisable in interface TaskQueueManagerqueueName - - disables queue from runningpublic void check()
throws InterruptedException
TaskQueueManagerBest invoked from a cron job or similar
check in interface TaskQueueManagerInterruptedException - when interruptedpublic void set(String queueName, QueueSettings settings)
TaskQueueManagerset in interface TaskQueueManagerqueueName - queue namesettings - to be storedprotected void stopRunningThreads(String queueName) throws InterruptedException
InterruptedExceptionCopyright © 2015. All rights reserved.