org.objectweb.jonathan.protocols.ip.lib
Class JConnectionMgr.Connection

java.lang.Object
  extended by org.objectweb.jonathan.protocols.ip.lib.JConnectionMgr.Connection
All Implemented Interfaces:
IpConnection
Enclosing class:
JConnectionMgr

public class JConnectionMgr.Connection
extends Object
implements IpConnection

Implementation of TcpIpConnection.


Constructor Summary
protected JConnectionMgr.Connection(IpConnection delegate)
          Builds a new connection.
 
Method Summary
 void acquire()
          Returns when the socket is acquired.
 int available()
           
 void delete()
          Deletes this connection, removing it from the connection manager, and closing the socket.
 void emit(Chunk chunk)
           
 String getHostName()
          Returns the host name of the underlying socket.
 int getPort()
          Returns the port number of the underlying socket.
 IpSession getSession()
          Returns the session attached to this connection.
 int hashCode()
           
 void receive(Chunk chunk, int to_read)
           
 void release()
          Releases this connection.
 void setSession(IpSession session)
          Attaches a new session to this connection.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JConnectionMgr.Connection

protected JConnectionMgr.Connection(IpConnection delegate)
                             throws org.objectweb.jonathan.apis.kernel.JonathanException
Builds a new connection.

Throws:
org.objectweb.jonathan.apis.kernel.JonathanException
Method Detail

available

public int available()
              throws IOException
Specified by:
available in interface IpConnection
Throws:
IOException

receive

public void receive(Chunk chunk,
                    int to_read)
             throws IOException
Specified by:
receive in interface IpConnection
Throws:
IOException

emit

public void emit(Chunk chunk)
          throws IOException
Specified by:
emit in interface IpConnection
Throws:
IOException

getPort

public int getPort()
Returns the port number of the underlying socket.

Specified by:
getPort in interface IpConnection
Returns:
the port number of the underlying socket.

getHostName

public String getHostName()
Returns the host name of the underlying socket.

Specified by:
getHostName in interface IpConnection
Returns:
the host name of the underlying socket.

getSession

public IpSession getSession()
Returns the session attached to this connection.

Specified by:
getSession in interface IpConnection
Returns:
the session attached to this connection.

setSession

public void setSession(IpSession session)
Attaches a new session to this connection.

Specified by:
setSession in interface IpConnection
Parameters:
session - the session to be attached to the target connection.

delete

public void delete()
Deletes this connection, removing it from the connection manager, and closing the socket. This method should not be used a a socket user unless a problem occurs on the connection, like an exception when trying to read or to write data.

Specified by:
delete in interface IpConnection

acquire

public void acquire()
Returns when the socket is acquired. This information is taken into account by the connection manager to avoid closing connections still in use.


release

public void release()
Releases this connection. This is to indicate to the connection manager that the target connection is no longer used.

Specified by:
release in interface IpConnection

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object