Package emissary.pickup
Class QueServer
- java.lang.Object
-
- java.lang.Thread
-
- emissary.core.Pausable
-
- emissary.pickup.QueServer
-
- Direct Known Subclasses:
FilePickUpClient.FileQueServer
public abstract class QueServer extends Pausable
Monitor thread for a PickupQueue and return items for processing. Operates in pull mode from a PickupSpace or push mode just monitoring the queue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_POLLING_INTERVAL
protected long
pollingInterval
protected PickupQueue
queue
protected IPickUpSpace
space
protected boolean
timeToShutdown
-
Fields inherited from class emissary.core.Pausable
DEFAULT_PAUSE_INTERVAL, pauseInterval
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description QueServer(IPickUpSpace space, PickupQueue queue)
CreateQueServer(IPickUpSpace space, PickupQueue queue, long pollingInterval)
Create with polling intervalQueServer(IPickUpSpace space, PickupQueue queue, long pollingInterval, String name)
Create with polling interval and thread name
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
checkQue()
Check the queue for waiting objects and process themboolean
enque(WorkBundle bundle)
Pass through to enqueue a work bundle on the injected queueint
getQueSize()
Pass through to get size of injected queueabstract boolean
processQueueItem(WorkBundle path)
Action to take when an item is removed from queuevoid
run()
Processing loop to monitor the queuevoid
shutdown()
Schedule this thread to stop soon-
Methods inherited from class emissary.core.Pausable
checkPaused, getPauseInterval, isPaused, pause, unpause
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
DEFAULT_POLLING_INTERVAL
public static final long DEFAULT_POLLING_INTERVAL
- See Also:
- Constant Field Values
-
pollingInterval
protected long pollingInterval
-
timeToShutdown
protected boolean timeToShutdown
-
queue
protected final PickupQueue queue
-
space
protected IPickUpSpace space
-
-
Constructor Detail
-
QueServer
public QueServer(IPickUpSpace space, PickupQueue queue)
Create- Parameters:
space
- the pickupspace controllerqueue
- the queue this thread monitors
-
QueServer
public QueServer(IPickUpSpace space, PickupQueue queue, long pollingInterval)
Create with polling interval- Parameters:
space
- the pickupspace controllerqueue
- the queue this thread monitorspollingInterval
- value in millis
-
QueServer
public QueServer(IPickUpSpace space, PickupQueue queue, long pollingInterval, String name)
Create with polling interval and thread name- Parameters:
space
- the pickupspace controllerqueue
- the queue this thread monitorspollingInterval
- value in millisname
- value to supply to Thread name
-
-
Method Detail
-
run
public void run()
Processing loop to monitor the queue
-
checkQue
public void checkQue()
Check the queue for waiting objects and process them
-
processQueueItem
public abstract boolean processQueueItem(WorkBundle path)
Action to take when an item is removed from queue- Parameters:
path
- the bundle from the queue- Returns:
- true if it worked
-
shutdown
public void shutdown()
Schedule this thread to stop soon
-
getQueSize
public int getQueSize()
Pass through to get size of injected queue- Returns:
- size of the queue
-
enque
public boolean enque(WorkBundle bundle)
Pass through to enqueue a work bundle on the injected queue- Parameters:
bundle
- the work bundle to enqueue- Returns:
- true if it was enqueued, false if we are too busy to handle it
-
-