public interface ClientConnection
Title: Open Service Framework
Description: Base interface for a reliable Client Connection. This interface provides an
implementation outline for all client connections that are created by the
ClientFactory
implementations. There is a strict hierarchy of ownership
that allows the creation of connection factories and subsequently all
connections only thru the management framework interface.
The Client connection interface is a template for an arbitrary socket based TCP connection. It provides some additional functionality not found in regular connections and facilitates a reliable communication channel into a given transport. Reliable implies that the connection mechanism has some logic built into it that tracks connection state and critical events, allowing developers to subscribe to such events in order to react to connection state changes when, for example, a back-end server has been shut down or made unavailable. If a network or other communications error has prevented access to the server a connection may (dependent on settings) automatically timeout, re-connect, abort the connection or block upstream operations from executing until communication is re-established. Alternatively the connection may be set up to roll over to an alternate URL. While this does not facilitate a Fault Tolerant behavior at the transaction level, it does provide a level of reliability that is ideal for environments that experience sparse connection outages or require automated failover to Disaster Recovery sites or alternate servers.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the target system.
|
void |
disconnect()
Disconnects from the target system.
|
ExceptionEventListener |
getExceptionEventListener()
Returns the exception event listener for this connection.
|
java.lang.String |
getName()
Returns the name of this connection
|
Logger |
getServiceLogger()
Gets the logger for this connection.
|
ConnectionState |
getState()
Returns the
ConnectionState for this connection. |
StateNotificationEventListener |
getStateNotificationEventListener()
Returns the state notifications listener for this connection.
|
void |
init(ClientFactory factory)
Initializes this connection with a set of parameters hosted in
Properties.
|
boolean |
isActive()
Returns
true if this connection is active. |
boolean |
isPrimary()
Returns
true if this connection is primary and the
first one used if a pool or fault-tolerant connection pair is defined. |
int |
ping()
Tests the connection, possibly returning a test result code.
|
void |
raiseException(java.lang.Exception e)
Raises an exception on this connection.
|
void |
resume()
Resumes a connection that has been suspended.
|
void |
setExceptionEventListener(ExceptionEventListener listener)
Sets the exception event listener for this connection.
|
void |
setPrimary(boolean primary)
Sets whether this connection is the primary one.
|
void |
setServiceLogger(Logger logger)
Sets the logger for this connection.
|
void |
setStateNotificationEventListener(StateNotificationEventListener listener)
Sets the state notification listener for this connection.
|
void |
suspend()
Suspends a connection to the target system.
|
java.lang.String getName()
void init(ClientFactory factory) throws ClientException
ClientException
int ping() throws ClientException
ClientException
void connect() throws ClientException
ClientException
void disconnect() throws ClientException
ClientException
void suspend()
void resume()
boolean isPrimary()
true
if this connection is primary and the
first one used if a pool or fault-tolerant connection pair is defined.void setPrimary(boolean primary)
primary
- booleanboolean isActive()
true
if this connection is active. If the
connection is suspended
or not connected this
method returns false
.void setServiceLogger(Logger logger)
logger
- ILoggerLogger getServiceLogger()
void setStateNotificationEventListener(StateNotificationEventListener listener)
null
deactivates listener forwarding.listener
- IStateNotificationEventListenerStateNotificationEventListener getStateNotificationEventListener()
void setExceptionEventListener(ExceptionEventListener listener)
listener
- IExceptionEventListenerExceptionEventListener getExceptionEventListener()
ConnectionState getState()
ConnectionState
for this connection.void raiseException(java.lang.Exception e)
e
- ExceptionCopyright © 2015-2024 StreamScape Technologies. All rights reserved.