|
|||||||||
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.Client<T>
public abstract class Client<T extends ClientConnectionPool>
Represents an X Platform client.
This class serves as the base class for X Platform clients. The core functionality implemented by this class is reliable, fault tolerant and load balanced communication with a server cluster using a pooled set of connections.
Client.State.INIT
state), a client
is not safe for concurrent access by multiple threads. Subsequent
to open, it is safe for concurrent access provided the contained connection
pool and the concrete client implementation are safe for concurrent thread
access.Nested Class Summary | |
---|---|
static class |
Client.State
Enumerates a client's states. |
Method Summary | |
---|---|
void |
close()
Close a client. |
T |
createConnection()
Create a nameless client connection for use with a client. |
T |
createConnection(String name)
Create a client connection for use with a client. |
void |
flush(ILnkPeerEndpoint.FlushContext flushContext)
Flush outbound messages buffered by a client's connection pool. |
ClientConnectionPool |
getConnectionPool()
Get a client's connection pool. |
String |
getName()
Get a client's name. |
Client.State |
getState()
Get a client's state |
String |
getType()
Get a client's type. |
void |
open()
Open a client. |
Client |
setConnectionPool(ClientConnectionPool pool)
Set a client's connection pool. |
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 getType()
The client type is a string describing the type of the concrete client implementation.
public final String getName()
public final Client.State getState()
public final Client setConnectionPool(ClientConnectionPool pool)
A client's connection pool can only be set before the client is opened.
public final ClientConnectionPool getConnectionPool()
This method can be invoked at any time during a client's lifetime.
public final T createConnection(String name)
name
- The name to be associated with the connection. This value
can be null in which case a nameless connection is created.
A client serves as the factory for connections compatible with itself. Therefore, the user should always use a client's connection factory method to create connections for use with the client.
public final T createConnection()
public final void open() throws EClientException
IllegalStateException
- Thrown in case the client is already open
or if a connection pool has not been set with the connection.
EClientException
- Thrown in case an error was encountered while
opening the client.This method opens the connection pool.
public final void flush(ILnkPeerEndpoint.FlushContext flushContext) throws EClientException
flushContext
- The flush context used to govern the flushing of
dirty connections in the connection pool. In case multiple connections
are flushed by this method, the pool is responsible for preserving the
semantics of the flush context by mapping the context to the individual
contexts of the flushed connections.
IllegalStateException
- Thrown in case the client is already open
or if a link context has not been set with the connection.
EClientException
- Thrown in case an error was encountered while
flushing the client's connection pool.This method performs basic validations and forwards the call to the contained pool. This method can only be invoked on an open client.
public final void close()
This method closes all client connections.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |