public class AsyncConnection extends ConnectionBase implements Connection
| Modifier and Type | Class and Description |
|---|---|
class |
AsyncConnection.RequestProcessor |
Connection.Event, Connection.Factory, Connection.Flag, Connection.Listener, Connection.Modality, Connection.Property, Connection.Socket, Connection.State| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.BlockingQueue<PendingRequest> |
pendingQueue |
private java.lang.Thread |
processerThread |
private AsyncConnection.RequestProcessor |
processor |
spec, thrdProtocol| Constructor and Description |
|---|
AsyncConnection(ConnectionSpec connectionSpec) |
| Modifier and Type | Method and Description |
|---|---|
Connection.Modality |
getModality() |
(package private) java.util.concurrent.BlockingQueue<PendingRequest> |
getPendingQueue() |
protected void |
initializeComponents()
Extension point: child classes may override for additional components:
|
protected java.io.InputStream |
newInputStream(java.io.InputStream socketInputStream)
Just make sure its a
FastBufferedInputStream. |
protected Protocol |
newProtocolHandler()
Pipeline must use a concurrent protocol handler.
|
java.util.concurrent.Future<Response> |
queueRequest(Command cmd,
byte[]... args)
A non-blocking call to service the specified request at some point in the future.
|
addListener, connect, disconnect, getInputStream, getOutputStream, getProtocolHandler, getSpec, initializeAsyncConnection, initializeOnConnect, initializeSocketStreams, initializeSyncConnection, isConnected, newOutputStream, notifyConnected, notifyDisconnected, notifyFaulted, notifyListeners, notifyShuttingDown, onConnectionFault, reconnect, removeListener, serviceRequest, shutdown, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, getSpec, removeListener, serviceRequestprivate AsyncConnection.RequestProcessor processor
private java.lang.Thread processerThread
private java.util.concurrent.BlockingQueue<PendingRequest> pendingQueue
public AsyncConnection(ConnectionSpec connectionSpec) throws ClientRuntimeException, ProviderException
java.util.concurrent.BlockingQueue<PendingRequest> getPendingQueue()
protected void initializeComponents()
ConnectionBase
In the extended class:
protected void initializeComponents() {
super.initializeComponents();
// my components here ...
//
}
initializeComponents in class ConnectionBaseprotected Protocol newProtocolHandler()
newProtocolHandler in class ConnectionBaseConnectionBase.newProtocolHandler()protected final java.io.InputStream newInputStream(java.io.InputStream socketInputStream)
throws java.lang.IllegalArgumentException
FastBufferedInputStream.newInputStream in class ConnectionBasejava.lang.IllegalArgumentExceptionpublic final Connection.Modality getModality()
public java.util.concurrent.Future<Response> queueRequest(Command cmd, byte[]... args) throws ClientRuntimeException, ProviderException
ConnectionFuture object of parametric type Response
When the request is serviced, call to Future.get() will return the request response.
Connection.Modality.Synchronous handlers must always throw a ClientRuntimeException
for this method which violates the contract for Connection.Modality.Synchronous handlers.
If request resulted in a redis error (RedisException), the exception will be set as the cause of
the corresponding ExecutionException of the Future object returned.
queueRequest in interface ConnectionqueueRequest in class ConnectionBaseFuture Response.ClientRuntimeExceptionProviderExceptionFuture,
ExecutionException