|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.gjsa.server.ServerThreadSession
Session of a connection in the server. Each client can have multiple session open in its connection. These sessions are started on top of each other. A session is able to answer requests and manage bursted replies. It does not care whether it belongs to a connectionbound or connectionless connection. It does also not care about threading issues. It is more or less an intelligent storage for data to which requests from the socket are delegated. The first session is created by the ServerThreadBase. Other sessions are always created out of already existing sessions by sending the command OPENSESSION. The next mode changing command will open a new session and execute that command in the new session. The ServerThreadSession takes a stack of lists of CommandExecutor objects. The lists are stored in ServerStackEntry objects which are linked in a Deque and form this way a stack.
A new ServerStackEntry is put at top of the server stack in two or three steps: First, startNewState() is called with the state's number. Then, properties can be put into the server stack using putProperty() and at last, the CommandExecutors are set with one of the finishNewState() methods. If no new properties are needed in the new state, steps one and three can be executed together with a newState() method.
ServerThreadBase
,
GJSAServer
,
SessionConnector
Field Summary | |
private boolean |
burstall
Description of the Field |
private int |
burstnextcount
Description of the Field |
private int |
burstsize
Description of the Field |
private java.util.Set |
childsessions
Sessions which are started from this session on. |
private boolean |
dirtystack
Description of the Field |
private ServerThreadSession |
fathersession
The session fron which this session was started, null if no father exists. |
private int |
id
Number of this session within its threadbase |
private int |
lastnewchildid
Storage of the last new child's id after its finalization |
private GJSAServer |
myserv
pointer to the Server object that has launched this ServerThreadSession |
private ServerThreadBase |
mythreadbase
The ServerThreadBase object that is base for this session object. |
private ServerThreadSession |
newchild
Temporary storage for a new child session during its creation |
private ServerStackEntry |
stackbase
place for specialized command executors to handle the requests passed by the client |
private ServerStackEntry |
stacktop
place for specialized command executors to handle the requests passed by the client |
private boolean |
syncburstfinished
Description of the Field |
private BurstMaker |
syncburstmaker
Description of the Field |
private java.util.List |
syncburstreplies
Description of the Field |
private int |
syncburststart
Description of the Field |
Constructor Summary | |
ServerThreadSession(ServerThreadBase stbx)
Constructor for initial session of a server thread. |
|
ServerThreadSession(ServerThreadSession stsx)
Constructor for derived session. |
Method Summary | |
void |
closeSession()
|
void |
closeSession(boolean quitall)
Removes the whole server stack. |
ServerReply |
continueSyncBurst()
continues a synchronous burst. |
void |
finishNewState(CommandExecutor commexec)
finish a new ServerStackEntry with one state specific CommandExecutor. |
void |
finishNewState(java.util.List commexecs)
finish a new ServerStackEntry with state specific CommandExecutors only. |
void |
finishNewState(java.util.List commexecs,
java.util.List allcommexecs)
finish a new server stack entry with state specific CommandExecutors and CommandExecutors that are called also in every further state. |
boolean |
getBurstAll()
Get if bursts anything burstable |
boolean |
getBurstNext()
Get if bursts next command. |
int |
getBurstSize()
Returns size of one burst chunk. |
GJSAServer |
getGJSAServer()
Returns the GJSA server to which this session belongs |
int |
getLastChildSessionID()
Return last new child's ID. |
java.lang.Object |
getProperty(java.lang.Object key)
Gets a property from the server stack. |
private java.lang.Object |
getPropertyRecursive(java.lang.Object key)
Internal recursive body of getProperty(). |
ServerThreadBase |
getServerThreadBase()
Returns the ServerThreadBase to which this session belongs |
int |
getSessionID()
Return my own session id |
int |
getState()
returns the state this session is just in |
boolean |
hasChildren()
Returns whether this session has any children |
ServerReply |
initBurstableReply(BurstMaker bm)
initiates a bursted reply. |
protected void |
internalOneSyncBurstStep()
Loads one sync burst result into the cache vector. |
boolean |
isComplex()
Returns whether this session has either more than one entry in the stack or a subsession. |
void |
leaveState()
Leaves the state the session is working in. |
boolean |
mayBeClosed()
returns whether the thread base may be closed or not. |
void |
newState(int newstate,
CommandExecutor commexec)
establish a new state with one state specific CommandExecutor. |
void |
newState(int newstate,
java.util.List commexecs)
establish a new state with state specific CommandExecutors only. |
void |
newState(int newstate,
java.util.List commexecs,
java.util.List allcommexecs)
establish a new state with state specific CommandExecutors and CommandExecutors that are called also in every further state. |
int |
openSession()
Initiate creation of a new session. |
java.lang.Object |
putProperty(java.lang.Object key,
java.lang.Object value)
puts a property into the server stack. |
void |
quitAll()
|
void |
registerNewChild()
Adds the newchild to the children of this session |
void |
releaseChild(ServerThreadSession sts)
Removes a child thread session from the children. |
java.lang.Object |
removeProperty(java.lang.Object key)
Removes a property from the server stack. |
ServerEnvelope |
reply(ServerEnvelope se)
handles a ServerEnvelope. |
ServerReply |
replyOneQuestion(ServerRequest sq)
|
ServerReply |
replyOneQuestion(ServerRequest sq,
boolean allonly)
handles one request and returns a reply |
void |
retractNewState()
retract a new state-to-be between startNewState and finishNewState |
void |
setBurstAll(boolean bx)
Set if shound burst anything burstable |
void |
setBurstNext(boolean bx)
Set if should burst next command. |
void |
setBurstSize(int s)
Sets size of one burst chunk. |
void |
startNewState(int newstate)
start a new state putting a new ServerStackEntry on top of the server stack. |
java.lang.String |
toString()
Description of the Method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private GJSAServer myserv
private ServerThreadBase mythreadbase
private ServerThreadSession fathersession
private java.util.Set childsessions
private int id
private ServerStackEntry stackbase
private ServerStackEntry stacktop
private boolean dirtystack
private boolean burstall
private int burstnextcount
private int burstsize
private BurstMaker syncburstmaker
private int syncburststart
private java.util.List syncburstreplies
private boolean syncburstfinished
private ServerThreadSession newchild
private int lastnewchildid
Constructor Detail |
public ServerThreadSession(ServerThreadBase stbx)
stbx
- The ServerThreadBase which initiates the session.public ServerThreadSession(ServerThreadSession stsx)
stsx
- The father session.Method Detail |
public void leaveState()
public void closeSession(boolean quitall)
public void closeSession()
public void quitAll()
public java.lang.Object putProperty(java.lang.Object key, java.lang.Object value)
key
- Description of the Parametervalue
- Description of the Parameter
public java.lang.Object getProperty(java.lang.Object key)
key
- The key of the property
private java.lang.Object getPropertyRecursive(java.lang.Object key)
key
- The key of the property
public java.lang.Object removeProperty(java.lang.Object key)
key
- The key to search for
public int getState()
public GJSAServer getGJSAServer()
public ServerThreadBase getServerThreadBase()
public int getSessionID()
public void registerNewChild()
public void releaseChild(ServerThreadSession sts)
public int openSession()
public int getLastChildSessionID()
public void newState(int newstate, java.util.List commexecs, java.util.List allcommexecs)
newstate
- Description of the Parametercommexecs
- Description of the Parameterallcommexecs
- Description of the Parameterpublic void newState(int newstate, java.util.List commexecs)
newstate
- Description of the Parametercommexecs
- Description of the Parameterpublic void newState(int newstate, CommandExecutor commexec)
newstate
- Description of the Parametercommexec
- Description of the Parameterpublic void startNewState(int newstate)
newstate
- Description of the Parameterpublic void retractNewState()
public void finishNewState(java.util.List commexecs, java.util.List allcommexecs)
commexecs
- Description of the Parameterallcommexecs
- Description of the Parameterpublic void finishNewState(java.util.List commexecs)
commexecs
- Description of the Parameterpublic void finishNewState(CommandExecutor commexec)
commexec
- Description of the Parameterpublic boolean hasChildren()
public boolean mayBeClosed()
public void setBurstAll(boolean bx)
bx
- The new burstAll valuepublic boolean getBurstAll()
public void setBurstNext(boolean bx)
bx
- The new burstNext valuepublic boolean getBurstNext()
public void setBurstSize(int s)
s
- The new burstSize valuepublic int getBurstSize()
public boolean isComplex()
protected void internalOneSyncBurstStep()
public ServerReply continueSyncBurst()
public ServerReply initBurstableReply(BurstMaker bm)
bm
- Description of the Parameter
public ServerReply replyOneQuestion(ServerRequest sq, boolean allonly) throws java.lang.Throwable
sq
- Description of the Parameter
java.lang.Throwable
- Description of the Exceptionpublic ServerReply replyOneQuestion(ServerRequest sq) throws java.lang.Throwable
java.lang.Throwable
public ServerEnvelope reply(ServerEnvelope se)
Note that this methods handles the complete encryption, e.g. it takes encrypted envelopes, decrypts them internally, and reencryts the result.
se
- Envelope containing all queries
public java.lang.String toString()
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |