|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cindy.session.AbstractSession
public abstract class AbstractSession
Abstract session.
Constructor Summary | |
---|---|
AbstractSession()
|
Method Summary | |
---|---|
void |
addSessionFilter(int index,
SessionFilter filter)
Add session filter. |
void |
addSessionFilter(SessionFilter filter)
Add session filter. |
boolean |
containsAttribute(java.lang.Object key)
Returns true if the session contains an attribute for the specified key. |
protected void |
dispatchException(java.lang.Throwable throwable)
|
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. |
int |
getReadPacketSize()
|
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. |
protected SessionFilterChain |
getSessionFilterChain(SessionFilter operateFilter,
boolean reversed)
|
SessionFilter[] |
getSessionFilters()
Get all session filters. |
SessionHandler |
getSessionHandler()
Get session handler. |
int |
getSessionTimeout()
Get session timeout, in millisecond. |
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. |
protected abstract Future |
send(java.lang.Object obj,
Packet packet,
int 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 |
setReadPacketSize(int size)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.cindy.Session |
---|
close, getSessionType, isStarted, start |
Constructor Detail |
---|
public AbstractSession()
Method Detail |
---|
public void setRemoteAddress(java.net.SocketAddress address)
Session
setRemoteAddress
in interface Session
address
- the remote addresspublic java.net.SocketAddress getRemoteAddress()
Session
getRemoteAddress
in interface Session
public void setLocalAddress(java.net.SocketAddress address)
Session
setLocalAddress
in interface Session
address
- the local addresspublic java.net.SocketAddress getLocalAddress()
Session
getLocalAddress
in interface Session
public PacketDecoder getPacketDecoder()
Session
getPacketDecoder
in interface Session
public PacketEncoder getPacketEncoder()
Session
getPacketEncoder
in interface Session
public void setPacketDecoder(PacketDecoder decoder)
Session
setPacketDecoder
in interface Session
decoder
- packet decoderpublic void setPacketEncoder(PacketEncoder encoder)
Session
setPacketEncoder
in interface Session
encoder
- packet encoderpublic int getReadPacketSize()
public void setReadPacketSize(int size)
public java.util.Map getAttributes()
Session
getAttributes
in interface Session
public java.lang.Object getAttribute(java.lang.Object key)
Session
getAttribute
in interface Session
key
- key
public boolean containsAttribute(java.lang.Object key)
Session
containsAttribute
in interface Session
key
- key
public void setAttribute(java.lang.Object key, java.lang.Object attribute)
Session
setAttribute
in interface Session
key
- keyattribute
- attributepublic void removeAttribute(java.lang.Object key)
Session
removeAttribute
in interface Session
key
- keypublic int getSessionTimeout()
Session
getSessionTimeout
in interface Session
public void setSessionTimeout(int timeout)
Session
setSessionTimeout
in interface Session
timeout
- session timeoutpublic void setSessionHandler(SessionHandler handler)
Session
setSessionHandler
in interface Session
handler
- session handlerpublic SessionHandler getSessionHandler()
Session
getSessionHandler
in interface Session
public void addSessionFilter(SessionFilter filter)
Session
addSessionFilter
in interface Session
filter
- session filterpublic void addSessionFilter(int index, SessionFilter filter)
Session
addSessionFilter
in interface Session
index
- indexfilter
- session filterpublic void removeSessionFilter(SessionFilter filter)
Session
removeSessionFilter
in interface Session
filter
- session filterpublic SessionFilter getSessionFilter(int index)
Session
getSessionFilter
in interface Session
index
- index
public SessionFilter[] getSessionFilters()
Session
getSessionFilters
in interface Session
public Future flush(Packet packet)
Session
flush
in interface Session
packet
- send packet
public Future flush(Packet packet, int priority)
Session
flush
in interface Session
packet
- send packetpriority
- send priority
public Future send(java.lang.Object obj)
Session
Packet
use associated PacketEncoder
. This
method is a shorthand for send(obj, 0).
send
in interface Session
obj
- send object
public Future send(java.lang.Object obj, int priority)
Session
Packet
use
associated PacketEncoder
.
send
in interface Session
obj
- send objectpriority
- send priority
protected abstract Future send(java.lang.Object obj, Packet packet, int priority)
public SessionFilterChain getSessionFilterChain(boolean reversed)
Session
getSessionFilterChain
in interface Session
reversed
- some events like xxxSend/xxxSent need to be dispatched in
reversed order
protected SessionFilterChain getSessionFilterChain(SessionFilter operateFilter, boolean reversed)
protected void dispatchException(java.lang.Throwable throwable)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |