|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Session
Session represents the network connection.
| Method Summary | |
|---|---|
void |
addSessionFilter(int index,
SessionFilter filter)
Add session filter. |
void |
addSessionFilter(SessionFilter filter)
Add session filter. |
Future |
close()
Close the session. |
boolean |
containsAttribute(java.lang.Object key)
Returns true if the session contains an attribute for the specified key. |
Future |
flush(Packet packet)
Send packet with normal priority. |
Future |
flush(Packet packet,
int priority)
Send packet with specified priority. |
java.lang.Object |
getAttribute(java.lang.Object key)
Get the session attribute mapped with the specified key. |
java.util.Map |
getAttributes()
Get all session attributs. |
java.net.SocketAddress |
getLocalAddress()
Get the local address which the session bind with. |
PacketDecoder |
getPacketDecoder()
Get packet decoder. |
PacketEncoder |
getPacketEncoder()
Get packet encoder. |
java.net.SocketAddress |
getRemoteAddress()
Get the remote address which the session connmected to. |
SessionFilter |
getSessionFilter(int index)
Get session filter. |
SessionFilterChain |
getSessionFilterChain(boolean reversed)
Get session filter chain. |
SessionFilter[] |
getSessionFilters()
Get all session filters. |
SessionHandler |
getSessionHandler()
Get session handler. |
int |
getSessionTimeout()
Get session timeout, in millisecond. |
SessionType |
getSessionType()
Get session type. |
boolean |
isStarted()
Session have started. |
void |
removeAttribute(java.lang.Object key)
Removes the attribute for this key if it is present. |
void |
removeSessionFilter(SessionFilter filter)
Remove session filter. |
Future |
send(java.lang.Object obj)
Send object with normal priority. |
Future |
send(java.lang.Object obj,
int priority)
Send object with specified priority. |
void |
setAttribute(java.lang.Object key,
java.lang.Object attribute)
Set session attribute. |
void |
setLocalAddress(java.net.SocketAddress address)
Set the local address which the session bind with. |
void |
setPacketDecoder(PacketDecoder decoder)
Set packet decoder. |
void |
setPacketEncoder(PacketEncoder encoder)
Set packet encoder. |
void |
setRemoteAddress(java.net.SocketAddress address)
Set the remote address which the session will connected to. |
void |
setSessionHandler(SessionHandler handler)
Set session handler. |
void |
setSessionTimeout(int timeout)
Set session timeout, in millisecond. |
Future |
start()
Start the session. |
| Method Detail |
|---|
SessionType getSessionType()
void setRemoteAddress(java.net.SocketAddress address)
address - the remote address
java.lang.IllegalStateExceptionjava.net.SocketAddress getRemoteAddress()
void setLocalAddress(java.net.SocketAddress address)
address - the local address
java.lang.IllegalStateExceptionjava.net.SocketAddress getLocalAddress()
void setPacketDecoder(PacketDecoder decoder)
decoder - packet decoderPacketDecoder getPacketDecoder()
void setPacketEncoder(PacketEncoder encoder)
encoder - packet encoderPacketEncoder getPacketEncoder()
java.util.Map getAttributes()
boolean containsAttribute(java.lang.Object key)
key - key
java.lang.Object getAttribute(java.lang.Object key)
key - key
void setAttribute(java.lang.Object key,
java.lang.Object attribute)
key - keyattribute - attributevoid removeAttribute(java.lang.Object key)
key - keyvoid setSessionTimeout(int timeout)
timeout - session timeoutint getSessionTimeout()
SessionFilterChain getSessionFilterChain(boolean reversed)
reversed - some events like xxxSend/xxxSent need to be dispatched in
reversed order
void addSessionFilter(SessionFilter filter)
filter - session filter
void addSessionFilter(int index,
SessionFilter filter)
index - indexfilter - session filtervoid removeSessionFilter(SessionFilter filter)
filter - session filterSessionFilter getSessionFilter(int index)
index - index
SessionFilter[] getSessionFilters()
void setSessionHandler(SessionHandler handler)
handler - session handlerSessionHandler getSessionHandler()
boolean isStarted()
Future start()
Future close()
Future flush(Packet packet)
packet - send packet
Future flush(Packet packet,
int priority)
packet - send packetpriority - send priority
Future send(java.lang.Object obj)
Packet use associated PacketEncoder. This
method is a shorthand for send(obj, 0).
obj - send object
Future send(java.lang.Object obj,
int priority)
Packet use
associated PacketEncoder.
obj - send objectpriority - send priority
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||