|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.root.RootObject
com.neeve.client.ClientConnectionPool
com.neeve.client.ClientConnection
public abstract class ClientConnection
Represents a connection between a client and server.
ClientConnectionPool.State.INIT
state), a connection object is not safe for concurrent access by
multiple threads. Subsequent to open, it is safe for concurrent access provided
the underlying link has been configured for concurrent thread access.Nested Class Summary | |
---|---|
class |
ClientConnection.DiscoveredLinkContext
|
Nested classes/interfaces inherited from class com.neeve.client.ClientConnectionPool |
---|
ClientConnectionPool.State |
Method Summary | |
---|---|
ClientConnection |
discoverLinkContext(String entityType,
String entityName,
Properties descriptorProps,
Properties linkManagerProps)
Discover the link context using the entity discovery protocol |
boolean |
getAutoReadStart()
Gets whether the connection read machinery is automatically started on open. |
Client |
getClient()
Get the connection's container client. |
ClientConnection.DiscoveredLinkContext |
getDiscoveredLinkContext()
Get the discovered link context. |
boolean |
getFaultTolerant()
Get a client connection's fault tolerant mode. |
String |
getGroup()
Get the application group of the client represented by a connection. |
ClientLinkManager |
getLinkManager()
Get the underlying link manager. |
String |
getLinkName()
Get the underlying link name. |
String |
getName()
Get the connection's name. |
int |
getReconnectTimeout()
Get a client connection's reconnect timeout. |
short |
getThreadAffinity()
Get a client connection's server thread affinity. |
ClientConnection |
setAutoReadStart(boolean val)
Sets whether the connection read machinery is automatically started on open. |
ClientConnection |
setFaultTolerant(boolean val)
Set whether a client connection should operate in a fault tolerant mode. |
ClientConnection |
setGroup(String group)
Set a the application group of the client represented by a connection. |
ClientConnection |
setLinkContext(ClientLinkManager linkManager,
String linkName)
Set the underlying link context using a link name and manager. |
ClientConnection |
setLinkContext(String descriptor,
Properties linkManagerProps)
Create and set the underlying link context using a link descriptor. |
ClientConnection |
setReconnectTimeout(int timeout)
Set a client connection's reconnect timeout. |
ClientConnection |
setThreadAffinity(short threadAffinity)
Set a client connection's server thread affinity. |
Methods inherited from class com.neeve.client.ClientConnectionPool |
---|
close, flush, getState, open, sendStreaming, sendSync, setMessageFactory |
Methods inherited from class com.neeve.root.RootObject |
---|
getChecked, getThreaded, getTracer, setChecked, setTracer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public final String getName()
This method can be invoked at any time during the lifetime of a connection.
public final Client getClient()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setGroup(String group)
This method is used to set the application group of the client represented by a connection to the server. A client can only connect to a server that is in the same application group as the client.
The client group can only be set before the connection is opened.
public final String getGroup()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setAutoReadStart(boolean val)
By default, when a client connection is opened, the open method will start the read machinery on the link manager associated which the underlying link. This method toggles that behaviour.
The auto read start state can only be changed before the connection is opened.
public final boolean getAutoReadStart()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setThreadAffinity(short threadAffinity)
This method sets the server thread affinity for a client connection. The thread affinity indicates which server I/O thread will be responsible for processing inbound traffic. The user should treat this setting as a hint to the system. It is not guaranteed that the affinity set here will be honored.
A connection's thread affinity can only be set before the connection is opened.
public final short getThreadAffinity()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setFaultTolerant(boolean val)
val
- A value of true sets the connection to be fault tolerant. A
value of false switches off the connection's fault tolerance.
This method sets whether a client connection should operate in a fault
tolerant manner. If set, then in the event of an underlying link failure,
the connection will attempt to reestablish the link for a maximum time
specified by the 'reconnect timeout' (see setReconnectTimeout(int)
)
before deeming the connection to be a failure.
A connection's fault tolerant mode can only be set before the connection is opened.
public final boolean getFaultTolerant()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setReconnectTimeout(int timeout)
timeout
- The maximum time, in seconds, that the reconnect logic
will attempt to reconnect a fault tolerant connection after giving up
and deeming the connection as failed.
A connection's fault tolerant reconnect timeout can only be set before the connection is opened.
public final int getReconnectTimeout()
This method can be invoked at any time during the lifetime of a connection.
public final ClientConnection setLinkContext(ClientLinkManager linkManager, String linkName)
linkManager
- The link manager managing the link.linkName
- The name of the link.
IllegalArgumentException
- Thrown in case the supplied link
manager or link name are null.
IllegalStateException
- Thrown in case the client is already open.
This method stores the name of the link and its manager to use to connect
to the server. The ClientConnectionPool.open()
method uses this information to establish
the underlying link.
public final ClientConnection setLinkContext(String descriptor, Properties linkManagerProps) throws EClientException
descriptor
- The link descriptor to use. Link descriptors are of
the format linkManagerProps
- A set of properties used to configure the link
manager created by this method.
IllegalArgumentException
- Thrown in case the supplied descriptor
is null.
IllegalStateException
- Thrown in case the client is already open.
EClientException
- Thrown in case an error was encountered while
creating the link context.
This method creates a link manager using the supplied properties, adds
the descriptor to the manager, generates a unique name for the contained
link and invokes setLinkContext(ClientLinkManager, String)
public final ClientConnection discoverLinkContext(String entityType, String entityName, Properties descriptorProps, Properties linkManagerProps) throws EClientException
entityType
- The type of entity to connect to.entityName
- The name of the entity to connect to.descriptorProps
- A set of properties to add to the discovered
link descriptor.linkManagerProps
- A set of properties used to configure the link
manager created by this method.
EClientException
This method uses the link discovery protocol to discover the link
descriptor of the entity specified by the entityType and
entityName parameters. This method then invoked the
setLinkContext(String, Properties)
method with the
discovered link descriptor to set the link context.
public final ClientConnection.DiscoveredLinkContext getDiscoveredLinkContext()
This method can be invoked at any time during the lifetime of a connection.
public final ClientLinkManager getLinkManager()
This method can be invoked at any time during the lifetime of a connection.
public final String getLinkName()
This method can be invoked at any time during the lifetime of a connection.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |