app.spa
Class SimplerSPAEventStreamChannel

java.lang.Object
  extended by app.spa.SimplerSPAEventStreamChannel
All Implemented Interfaces:
SPAEventStreamSource, SPAEventTarget

public class SimplerSPAEventStreamChannel
extends java.lang.Object
implements SPAEventTarget, SPAEventStreamSource

A simpler version of SPAEventStreamChannel, implementing exactly the same behavioural spec, but doing so using synchronization Tokens directly rather than indirectly wrapped up in SynchBufMultiProds and SynchBufSingleProds.

("Simpler" here refers to the synchronization apparatus, rather than to the code which is acually a bit more complex than that of SPAEventStreamChannel, due to the need for explicit synchronization code in this case.)


Constructor Summary
SimplerSPAEventStreamChannel(Logger lggr)
          Constructs a new event channel, using the given logger.
 
Method Summary
 void deliverAck(SPAEventAck ack)
          Delivers the given acknowledgement in response to the most recently obtained player event.
 void deliverAck(java.lang.String ackmsg)
          Delivers a new failure acknowledgement with the given descriptive text.
 void deliverOKAck()
          Delivers an OK acknowledgement.
 SPAEvent getNextEvent()
          Obtains and returns the most recently posted player event, blocking if necessary until it becomes available.
 SPAEventAck postEvent(EventId eid)
          Posts a new event with the given id to this channel, blocking if necessary until it is ready to accept it, before obtaining and returning the corresponding acknowledgment.
 SPAEventAck postEvent(SPAEvent evt)
          Posts the given event to this channel, blocking if necessary until it is ready to accept it, before obtaining and returning the corresponding acknowledgment.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplerSPAEventStreamChannel

public SimplerSPAEventStreamChannel(Logger lggr)
Constructs a new event channel, using the given logger.

Method Detail

postEvent

public SPAEventAck postEvent(SPAEvent evt)
Posts the given event to this channel, blocking if necessary until it is ready to accept it, before obtaining and returning the corresponding acknowledgment.

Specified by:
postEvent in interface SPAEventTarget

postEvent

public SPAEventAck postEvent(EventId eid)
Posts a new event with the given id to this channel, blocking if necessary until it is ready to accept it, before obtaining and returning the corresponding acknowledgment.

Specified by:
postEvent in interface SPAEventTarget

getNextEvent

public SPAEvent getNextEvent()
                      throws java.lang.InterruptedException
Obtains and returns the most recently posted player event, blocking if necessary until it becomes available.

Specified by:
getNextEvent in interface SPAEventStreamSource
Throws:
java.lang.InterruptedException

deliverAck

public void deliverAck(SPAEventAck ack)
                throws java.lang.InterruptedException
Delivers the given acknowledgement in response to the most recently obtained player event.

Specified by:
deliverAck in interface SPAEventStreamSource
Throws:
java.lang.InterruptedException

deliverOKAck

public void deliverOKAck()
                  throws java.lang.InterruptedException
Delivers an OK acknowledgement.

Specified by:
deliverOKAck in interface SPAEventStreamSource
Throws:
java.lang.InterruptedException

deliverAck

public void deliverAck(java.lang.String ackmsg)
                throws java.lang.InterruptedException
Delivers a new failure acknowledgement with the given descriptive text.

Specified by:
deliverAck in interface SPAEventStreamSource
Throws:
java.lang.InterruptedException