org.objectweb.jonathan.libs.resources.tcpip
Class JConnectionMgr
java.lang.Object
|
+--org.objectweb.jonathan.libs.resources.tcpip.JConnectionMgr
- All Implemented Interfaces:
- TcpIpConnectionMgr
- public class JConnectionMgr
- extends Object
- implements TcpIpConnectionMgr
Default implementation of a connection manager and factory.
|
Field Summary |
int |
max_idle
Maximum number of idle connections kept by this manager.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
max_idle
public int max_idle
- Maximum number of idle connections kept by this manager.
This constant is defined under the name
/jonathan/tcpip/max_idle
in the bootstrap context.
getCanonicalHostName
public String getCanonicalHostName(String hostname)
- Returns the canonical host name of the provided host.
- Specified by:
getCanonicalHostName in interface TcpIpConnectionMgr
- Parameters:
hostname - a host name- Returns:
- the corresponding canonical host name.
newCltConnection
public IpConnection newCltConnection(String host,
int port,
IpSession session)
throws JonathanException
- Returns a new client connection.
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.
- Specified by:
newCltConnection in interface TcpIpConnectionMgr
- Parameters:
host - the host name of the distant server;port - the port number of a server socket on that host;session - a TcpIp session- Returns:
- a connection for that session.
- Throws:
JonathanException - if an error occurs.
newSrvConnectionFactory
public TcpIpSrvConnectionFactory newSrvConnectionFactory(int port)
throws JonathanException
- Returns a new server connection factory encapsulating a server socket on the
provided port. If port = 0, an anonymous server socket is opened.
- Specified by:
newSrvConnectionFactory in interface TcpIpConnectionMgr
- Parameters:
port - the expected port of the server socket;- Returns:
- a server connection factory.
- Throws:
JonathanException - if an error occurs.
newCltConnection
protected JConnectionMgr.Connection newCltConnection(IpConnection connection)
throws JonathanException
- Builds a new client-side connection encapsulating the provided connection.
- Parameters:
connection - a tcpip connection.- Returns:
- a new client-side connection.
- Throws:
JonathanException - JonathanException if something goes wrong.