public class JConnectionMgr extends Object implements TcpIpConnectionMgr
Modifier and Type | Class and Description |
---|---|
class |
JConnectionMgr.Connection
Implementation of TcpIpConnection.
|
Modifier and Type | Field and Description |
---|---|
protected TcpIpConnectionMgr |
factory |
int |
max_idle
Maximum number of idle connections kept by this manager.
|
Constructor and Description |
---|
JConnectionMgr(int max_idle,
TcpIpConnectionMgr connection_factory)
Returns a new connection manager
|
Modifier and Type | Method and Description |
---|---|
String |
getCanonicalHostName(String hostname)
Returns the canonical host name of the provided host.
|
protected JConnectionMgr.Connection |
newCltConnection(IpConnection connection)
Builds a new client-side connection encapsulating the provided connection.
|
IpConnection |
newCltConnection(String host,
int port,
IpSession session)
Returns a new client connection.
|
TcpIpSrvConnectionFactory |
newSrvConnectionFactory(int port)
Returns a new server connection factory encapsulating a server socket on the
provided port.
|
protected TcpIpConnectionMgr factory
public int max_idle
/jonathan/tcpip/max_idle
in the bootstrap context.public JConnectionMgr(int max_idle, TcpIpConnectionMgr connection_factory)
max_idle
- maximum number of idle connectionsconnection_factory
- a factory to actually create connectionspublic String getCanonicalHostName(String hostname)
getCanonicalHostName
in interface TcpIpConnectionMgr
hostname
- a host namepublic IpConnection newCltConnection(String host, int port, IpSession session) throws org.objectweb.jonathan.apis.kernel.JonathanException
This method is called by a protocol. The protocol provides a session (i.e. an object representing an abstract communication channel) and expects a connection (i.e. a communication resource). The returned connection must have been built using the provided session, or be a connection associated with a session having the same destination as the provided session.
newCltConnection
in interface TcpIpConnectionMgr
host
- the host name of the distant server;port
- the port number of a server socket on that host;session
- a TcpIp sessionorg.objectweb.jonathan.apis.kernel.JonathanException
- if an error occurs.public TcpIpSrvConnectionFactory newSrvConnectionFactory(int port) throws org.objectweb.jonathan.apis.kernel.JonathanException
newSrvConnectionFactory
in interface TcpIpConnectionMgr
port
- the expected port of the server socket;org.objectweb.jonathan.apis.kernel.JonathanException
- if an error occurs.protected JConnectionMgr.Connection newCltConnection(IpConnection connection) throws org.objectweb.jonathan.apis.kernel.JonathanException
connection
- a tcpip connection.org.objectweb.jonathan.apis.kernel.JonathanException
- JonathanException if something goes wrong.