com.caucho.env.actor
Class AbstractWorkerQueue<T>

java.lang.Object
  extended by com.caucho.env.actor.AbstractActorProcessor<T>
      extended by com.caucho.env.actor.AbstractWorkerQueue<T>
All Implemented Interfaces:
ActorProcessor<T>

public abstract class AbstractWorkerQueue<T>
extends AbstractActorProcessor<T>

Ring-based memory queue processed by a single worker.


Constructor Summary
AbstractWorkerQueue(int size)
           
 
Method Summary
 int getSize()
           
 java.lang.String getThreadName()
          Returns the current thread name.
 boolean isEmpty()
           
 boolean offer(T value)
           
 void onProcessComplete()
          Called when all items in the queue are processed.
abstract  void process(T value)
          Process a single item.
 void wake()
           
 
Methods inherited from class com.caucho.env.actor.AbstractActorProcessor
onProcessStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWorkerQueue

public AbstractWorkerQueue(int size)
Method Detail

isEmpty

public final boolean isEmpty()

getSize

public final int getSize()

offer

public final boolean offer(T value)

wake

public final void wake()

getThreadName

public java.lang.String getThreadName()
Description copied from class: AbstractActorProcessor
Returns the current thread name.

Specified by:
getThreadName in interface ActorProcessor<T>
Overrides:
getThreadName in class AbstractActorProcessor<T>

process

public abstract void process(T value)
Description copied from class: AbstractActorProcessor
Process a single item.

Specified by:
process in interface ActorProcessor<T>
Specified by:
process in class AbstractActorProcessor<T>

onProcessComplete

public void onProcessComplete()
Description copied from class: AbstractActorProcessor
Called when all items in the queue are processed. This can be used to flush buffers.

Specified by:
onProcessComplete in interface ActorProcessor<T>
Overrides:
onProcessComplete in class AbstractActorProcessor<T>