net.sf.asyncobjects.vats
Class VatQueueRunner

java.lang.Object
  extended by net.sf.asyncobjects.vats.VatRunner
      extended by net.sf.asyncobjects.vats.VatQueueRunner
All Implemented Interfaces:
VatFactory
Direct Known Subclasses:
SingleThreadIdleRunner, SingleThreadRunner

public abstract class VatQueueRunner
extends VatRunner

This is a runner that has own queue of vats. Such vat runners also usually use own dispatch loop.

Author:
const

Nested Class Summary
protected  class VatQueueRunner.EnqueuedVat
          An enqueued vat
 
Nested classes/interfaces inherited from class net.sf.asyncobjects.vats.VatRunner
VatRunner.VatRunnerState
 
Field Summary
protected  LinkedBlockingQueue<VatQueueRunner.EnqueuedVat> queue
          queue that contains vats to execute
 
Fields inherited from class net.sf.asyncobjects.vats.VatRunner
state, stateLock
 
Constructor Summary
VatQueueRunner()
           
 
Method Summary
protected  boolean hasEvents(Vat vat, Object ticket)
          This method is called by the vat when new events have arrived.
 
Methods inherited from class net.sf.asyncobjects.vats.VatRunner
cancelledEqueuedVat, getBachingFactor, getState, newVat, newVat, setBachingFactor, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

protected final LinkedBlockingQueue<VatQueueRunner.EnqueuedVat> queue
queue that contains vats to execute

Constructor Detail

VatQueueRunner

public VatQueueRunner()
Method Detail

hasEvents

protected boolean hasEvents(Vat vat,
                            Object ticket)
Description copied from class: VatRunner
This method is called by the vat when new events have arrived. This method should never block and to be as fast as possible. This method executed within synchronoization over Vat's state lock. The vat enqueues itself only if is not running or enqueued yet.

Specified by:
hasEvents in class VatRunner
Parameters:
vat - a vat that has new events and is associated with the runner
ticket - a ticket from the vat
Returns:
true if runner accpets the vat, false otherwise (happens if runner is stopped or is stopping)
See Also:
VatRunner.hasEvents(net.sf.asyncobjects.vats.Vat, java.lang.Object)


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.