edu.cuny.cat.comm
Class CatpReactiveSession

java.lang.Object
  extended by edu.cuny.cat.comm.Session<CatpMessage>
      extended by edu.cuny.cat.comm.CatpReactiveSession
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
GameClient.DayClosedSession, GameClient.GameOverSession, GameClient.GameStartedSession, GameClient.GameStartingSession, GameClient.OracleSession, GameClient.PostSession, GameClient.RoundClosedSession, GameClient.RoundClosingSession, GameClient.RoundOpenedSession, GameClient.SyncSession, MarketClient.DayOpenedSession, MarketClient.DayOpeningSession, MarketClient.RegisterSession, MarketClient.ShoutSession, MarketClient.SubscribeFromClientSession, TraderClient.TransactionSession

public abstract class CatpReactiveSession
extends Session<CatpMessage>
implements java.lang.Cloneable

This class processes a request/response session initiated by the other party over a capt connection.

For a reactive party, several different sessions may be expected at a moment. Detection on which sessions a coming request belongs to is done by trying processRequest(CatpRequest), which should set processed to true if a session is certain it is the right one to process the request, or false otherwise. CatException may be thrown thrown by the right session if anything wrong with the request.

Version:
$Revision: 1.13 $
Author:
Jinzhong Niu

Field Summary
protected  boolean processed
          indicates whether or not this session has processed the request and sent a response.
protected  java.lang.String reqType
           
protected  java.lang.String typeHeader
           
 
Fields inherited from class edu.cuny.cat.comm.Session
MAX_ATTEMPT
 
Constructor Summary
CatpReactiveSession(Connection<CatpMessage> connection, java.lang.String reqType)
           
CatpReactiveSession(Connection<CatpMessage> connection, java.lang.String reqType, java.lang.String typeHeader)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean isProcessed()
           
 void processRequest(CatpRequest request)
           
 void setProcessed(boolean processed)
           
 
Methods inherited from class edu.cuny.cat.comm.Session
forceOut, sendMessage, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reqType

protected java.lang.String reqType

typeHeader

protected java.lang.String typeHeader

processed

protected boolean processed
indicates whether or not this session has processed the request and sent a response.

See Also:
processRequest(CatpRequest)
Constructor Detail

CatpReactiveSession

public CatpReactiveSession(Connection<CatpMessage> connection,
                           java.lang.String reqType)

CatpReactiveSession

public CatpReactiveSession(Connection<CatpMessage> connection,
                           java.lang.String reqType,
                           java.lang.String typeHeader)
Method Detail

processRequest

public void processRequest(CatpRequest request)
                    throws CatException
Throws:
CatException

isProcessed

public boolean isProcessed()

setProcessed

public void setProcessed(boolean processed)

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object