net.sf.cindy.session.nio
Class SocketChannelSession

java.lang.Object
  extended by net.sf.cindy.session.AbstractSession
      extended by net.sf.cindy.session.nio.AbstractChannelSession
          extended by net.sf.cindy.session.nio.SocketChannelSession
All Implemented Interfaces:
Session

public class SocketChannelSession
extends AbstractChannelSession

Socket channel session.

Version:
$id$
Author:
Roger Chen

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.cindy.session.nio.AbstractChannelSession
AbstractChannelSession.ChannelReactorHandler
 
Constructor Summary
SocketChannelSession()
           
 
Method Summary
protected  void doClose()
           
protected  void doStart()
           
 java.nio.channels.SocketChannel getChannel()
          Get the socket channel which the session will connected to.
 java.net.SocketAddress getLocalAddress()
          Get the local address which the session bind with.
protected  ReactorHandler getReactorHandler()
          Get reactor handler.
 java.net.SocketAddress getRemoteAddress()
          Get the remote address which the session connmected to.
 SessionType getSessionType()
          Get session type.
 java.net.Socket getSocket()
           
 void setChannel(java.nio.channels.SocketChannel channel)
          Set the socket channel which the session will used.
 
Methods inherited from class net.sf.cindy.session.nio.AbstractChannelSession
close, getReactor, isStarted, send, start
 
Methods inherited from class net.sf.cindy.session.AbstractSession
addSessionFilter, addSessionFilter, containsAttribute, dispatchException, flush, flush, getAttribute, getAttributes, getPacketDecoder, getPacketEncoder, getReadPacketSize, getSessionFilter, getSessionFilterChain, getSessionFilterChain, getSessionFilters, getSessionHandler, getSessionTimeout, removeAttribute, removeSessionFilter, send, send, setAttribute, setLocalAddress, setPacketDecoder, setPacketEncoder, setReadPacketSize, setRemoteAddress, setSessionHandler, setSessionTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketChannelSession

public SocketChannelSession()
Method Detail

getSessionType

public SessionType getSessionType()
Description copied from interface: Session
Get session type.

Returns:
session type

getLocalAddress

public java.net.SocketAddress getLocalAddress()
Description copied from interface: Session
Get the local address which the session bind with.

Specified by:
getLocalAddress in interface Session
Overrides:
getLocalAddress in class AbstractSession
Returns:
the local address

getRemoteAddress

public java.net.SocketAddress getRemoteAddress()
Description copied from interface: Session
Get the remote address which the session connmected to.

Specified by:
getRemoteAddress in interface Session
Overrides:
getRemoteAddress in class AbstractSession
Returns:
the remote address

setChannel

public void setChannel(java.nio.channels.SocketChannel channel)
Set the socket channel which the session will used.

Parameters:
channel - the scoket channel
Throws:
java.lang.IllegalStateException

getChannel

public java.nio.channels.SocketChannel getChannel()
Get the socket channel which the session will connected to.

Returns:
the scoket channel

getSocket

public java.net.Socket getSocket()

getReactorHandler

protected ReactorHandler getReactorHandler()
Description copied from class: AbstractChannelSession
Get reactor handler.

Specified by:
getReactorHandler in class AbstractChannelSession
Returns:
reactor handler

doStart

protected void doStart()
                throws java.io.IOException
Overrides:
doStart in class AbstractChannelSession
Throws:
java.io.IOException

doClose

protected void doClose()
Overrides:
doClose in class AbstractChannelSession