/**
* Works off the thread's work queue.
*/
public void processThreadWorkQueue()
{
DualWorkQueue queues = threadWorkQueue.getThreadQueue();
if (queues.getFrontQueue().isEmpty()) {
boolean haveDispatched = services.getNamedWindowService().dispatch(engineFilterAndDispatchTimeContext);
if (haveDispatched)
{
// Dispatch results to listeners
dispatch();
}
}
else {
Object item;
while ( (item = queues.getFrontQueue().poll()) != null)
{
if (item instanceof InsertIntoLatchSpin)
{
processThreadWorkQueueLatchedSpin((InsertIntoLatchSpin) item);
}
else if (item instanceof InsertIntoLatchWait)
{
processThreadWorkQueueLatchedWait((InsertIntoLatchWait) item);
}
else
{
processThreadWorkQueueUnlatched(item);
}
boolean haveDispatched = services.getNamedWindowService().dispatch(engineFilterAndDispatchTimeContext);
if (haveDispatched)
{
dispatch();
}
}
}
Object item;
while ( (item = queues.getBackQueue().poll()) != null)
{
if (item instanceof InsertIntoLatchSpin)
{
processThreadWorkQueueLatchedSpin((InsertIntoLatchSpin) item);
}
else if (item instanceof InsertIntoLatchWait)
{
processThreadWorkQueueLatchedWait((InsertIntoLatchWait) item);
}
else
{
processThreadWorkQueueUnlatched(item);
}
boolean haveDispatched = services.getNamedWindowService().dispatch(engineFilterAndDispatchTimeContext);
if (haveDispatched)
{
dispatch();
}
if (!queues.getFrontQueue().isEmpty()) {
processThreadWorkQueue();
}
}
}