Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.connection
Class ConnectionManager

java.lang.Object
  extended bycom.genesyslab.platform.commons.connection.ConnectionManager

public final class ConnectionManager
extends java.lang.Object

Factory for connections. You can change connection implementation by setting system property 'com.genesyslab.platform.commons.connection.factory.class' to fully qualified name of the connection factory implementation. Currently there is two implementations. First one is default implementation based on single thread and multiplexed IO. The second implementation creates two threads per connection and uses stream-based IO. Its usage is recommended only in cases when default implementation does not work for you (e.g. JRE <= 1.3). It's perfomance can be quite slow for large amount of connections and some advanced connections (like HA connection in TLib) can be unreliable with it.


Method Summary
static ConnectionAcceptor createAcceptor(java.net.SocketAddress address, ConnectionListener listener)
          Create connection acceptor object for the specified address.
static ConnectionAcceptor createAcceptor(java.lang.String host, int port, ConnectionListener listener)
          Create connection acceptor object for the specified address.
static Connection createConnection(java.net.InetAddress address, int port)
          Create connection object for the specified server.
static Connection createConnection(java.lang.String host, int port)
          Create connection object for the specified server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createConnection

public static Connection createConnection(java.lang.String host,
                                          int port)
Create connection object for the specified server. Connection is not opened upon creation. You have to use its open method to establish network connection.

Parameters:
host - host to connect to
port - port to connect to
Returns:
connection for the specified parameters

createConnection

public static Connection createConnection(java.net.InetAddress address,
                                          int port)
Create connection object for the specified server. Connection is not opened upon creation. You have to use its open method to establish network connection.

Parameters:
address - host to connect to
port - port to connect to
Returns:
connection for the specified parameters

createAcceptor

public static ConnectionAcceptor createAcceptor(java.lang.String host,
                                                int port,
                                                ConnectionListener listener)
Create connection acceptor object for the specified address. Acceptor is not bound upon creation. You have to use its startAccepting method to bind a socket.

Parameters:
host - host to listen
port - port to listen on
listener - a listener to notify about new connections
Returns:
connection for the specified parameters

createAcceptor

public static ConnectionAcceptor createAcceptor(java.net.SocketAddress address,
                                                ConnectionListener listener)
Create connection acceptor object for the specified address. Acceptor is not bound upon creation. You have to use its startAccepting method to bind a socket.

Parameters:
address - address to listen
listener - a listener to notify about new connections
Returns:
connection for the specified parameters

Configuration Platform SDK 7.6 API Reference

Send comments on this topic.
Copyright © 2006–2008 Genesys Telecommunication Laboratories, Inc. All rights reserved.