Configuration Platform SDK 7.6 API Reference

com.genesyslab.platform.commons.connection
Interface Connection


public interface Connection

Allows for direct communication with a server using TCP/IP. This low-level connection is encapsulated by the Channel classes, such as ClientChannel. The Channel classes present a message-based interface to your applications.

For Genesys internal use only.


Field Summary
static java.lang.String BIND_HOST_KEY
           
static java.lang.String BIND_PORT_KEY
           
 
Method Summary
 void close()
          Close connection to the server.
 void configure(ConnectionConfiguration config)
          Configure or reconfigure this connection's additional parameters.
 void forceClose()
          Close the connection without waiting for pending messages.
 ConnectionState getConnectionState()
          Return connection state of this connection.
 java.lang.String getHost()
          Get host of the connection.
 com.genesyslab.platform.commons.connection.interceptor.Interceptor getInterceptor()
          Return interceptor of this connection.
 MessagePackager getMessagePackager()
           
 MessageTransport getMessageTransport()
           
 int getPort()
          Get port of the connection.
 java.lang.String getUri()
          Get address of the connection.
 void open()
          Open network connection to the server.
 void setConnectionHandler(ConnectionHandler connectionHandler)
          Set connection handler to receive notifications about connection events.
 void setInvoker(AsyncInvoker invoker)
          Connection can use invoker (if it's set) to parse messages.
 void setMessagePackager(MessagePackager packager)
           
 void setMessageTransport(MessageTransport transport)
           
 

Field Detail

BIND_HOST_KEY

public static final java.lang.String BIND_HOST_KEY
See Also:
Constant Field Values

BIND_PORT_KEY

public static final java.lang.String BIND_PORT_KEY
See Also:
Constant Field Values
Method Detail

open

public void open()
Open network connection to the server. Please note, that usually this method will return immediately and won't wait while connection is established. (connection process is asynchronous).


close

public void close()
Close connection to the server. The connection is closed "gracefully". In other words pending messages are delivered to remote party before the connection is actually closed. The second open() after close is not guarantied to work properly (depends on implementation).


forceClose

public void forceClose()
Close the connection without waiting for pending messages. The checks count during this operation is minimal, so be careful.


getConnectionState

public ConnectionState getConnectionState()
Return connection state of this connection.

Returns:
connection state.

getUri

public java.lang.String getUri()
Get address of the connection.

Returns:
connection address

getHost

public java.lang.String getHost()
Get host of the connection.

Returns:
connection's host

getPort

public int getPort()
Get port of the connection.

Returns:
connection's port

setConnectionHandler

public void setConnectionHandler(ConnectionHandler connectionHandler)
Set connection handler to receive notifications about connection events.

Parameters:
connectionHandler - connection handler implemntation

configure

public void configure(ConnectionConfiguration config)
Configure or reconfigure this connection's additional parameters. (e.g. ADDP).

Parameters:
config - Connection parameters.

getInterceptor

public com.genesyslab.platform.commons.connection.interceptor.Interceptor getInterceptor()
Return interceptor of this connection.

Returns:
interceptor of the connection

setMessagePackager

public void setMessagePackager(MessagePackager packager)

getMessagePackager

public MessagePackager getMessagePackager()

setMessageTransport

public void setMessageTransport(MessageTransport transport)

getMessageTransport

public MessageTransport getMessageTransport()

setInvoker

public void setInvoker(AsyncInvoker invoker)
Connection can use invoker (if it's set) to parse messages. It is recomended to use the invoker if you know that it can take long to parse the message. Wether invoker will be used or not is implementation specific. For instance it seems a good idea to set some kind of thread pool as invoker for some busy connection, but you can break the order of message arrival by doing so.

Parameters:
invoker - async invoker

Configuration Platform SDK 7.6 API Reference

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