org.objectweb.jonathan.protocols.ip.lib

Class JConnectionMgr.Connection

Enclosing Class:
JConnectionMgr
Implemented Interfaces:
IpConnection

public class JConnectionMgr.Connection
extends Object
implements IpConnection

Implementation of TcpIpConnection.

Constructor Summary

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()

Constructor Details

Connection

protected Connection(IpConnection delegate)
            throws JonathanException
Builds a new connection.

Method Details

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.


available

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


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


emit

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


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.


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.


getSession

public IpSession getSession()
Returns the session attached to this connection.
Specified by:
getSession in interface IpConnection

Returns:
the session attached to this connection.


hashCode

public int hashCode()


receive

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


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


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.


toString

public String toString()