Package adams.flow.core
Class QueueHelper
- java.lang.Object
-
- adams.flow.core.QueueHelper
-
public class QueueHelper extends Object
Helper class for queue handling.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description QueueHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
enqueue(Actor actor, StorageName queue, Object payload)
Queues the payload in the specified queue.static boolean
enqueueDelayedAt(Actor actor, StorageName queue, Object payload, long retrievalAt)
Queues the payload in the specified queue, applying the specified retrieval timestamp.static boolean
enqueueDelayedBy(Actor actor, StorageName queue, Object payload, long retrievalDelay)
Queues the payload in the specified queue, applying the specified retrieval delay.static StorageQueueHandler
getQueue(Actor actor, StorageName queue)
Returns the specified queue.static boolean
hasQueue(Actor actor, StorageName queue)
Checks whether the specified queue is available.
-
-
-
Method Detail
-
hasQueue
public static boolean hasQueue(Actor actor, StorageName queue)
Checks whether the specified queue is available.- Parameters:
actor
- the actor to check forqueue
- the name of the queue- Returns:
- true if available
-
getQueue
public static StorageQueueHandler getQueue(Actor actor, StorageName queue)
Returns the specified queue.- Parameters:
actor
- the actor to obtain the queue forqueue
- the name of the queue- Returns:
- the queue handler, null if not available
-
enqueue
public static boolean enqueue(Actor actor, StorageName queue, Object payload)
Queues the payload in the specified queue.- Parameters:
actor
- the actor to obtain the queue forqueue
- the name of the queuepayload
- the data to queue- Returns:
- true if successfully queued
-
enqueueDelayedBy
public static boolean enqueueDelayedBy(Actor actor, StorageName queue, Object payload, long retrievalDelay)
Queues the payload in the specified queue, applying the specified retrieval delay.- Parameters:
actor
- the actor to obtain the queue forqueue
- the name of the queuepayload
- the data to queueretrievalDelay
- the delay to enforce on this object- Returns:
- true if successfully queued
-
enqueueDelayedAt
public static boolean enqueueDelayedAt(Actor actor, StorageName queue, Object payload, long retrievalAt)
Queues the payload in the specified queue, applying the specified retrieval timestamp.- Parameters:
actor
- the actor to obtain the queue forqueue
- the name of the queuepayload
- the data to queueretrievalAt
- the delay to enforce on this object- Returns:
- true if successfully queued
-
-