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
spec
Constructor and Description |
---|
AsyncConnection(ConnectionSpec connectionSpec) |
Modifier and Type | Method and Description |
---|---|
Connection.Modality |
getModality() |
protected void |
initializeComponents()
Extension point: child classes may override for additional components:
|
protected InputStream |
newInputStream(InputStream socketInputStream)
Just make sure its a
FastBufferedInputStream . |
protected Protocol |
newProtocolHandler()
Pipeline must use a concurrent protocol handler.
|
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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, getSpec, removeListener, serviceRequest
public AsyncConnection(ConnectionSpec connectionSpec) throws ClientRuntimeException, ProviderException
protected void initializeComponents()
ConnectionBase
In the extended class:
protected void initializeComponents() {
super.initializeComponents();
// my components here ...
//
}
initializeComponents
in class ConnectionBase
protected Protocol newProtocolHandler()
newProtocolHandler
in class ConnectionBase
ConnectionBase.newProtocolHandler()
protected final InputStream newInputStream(InputStream socketInputStream) throws IllegalArgumentException
FastBufferedInputStream
.newInputStream
in class ConnectionBase
IllegalArgumentException
public final Connection.Modality getModality()
public Future<Response> queueRequest(Command cmd, byte[]... args) throws ClientRuntimeException, ProviderException
Connection
Future
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 Connection
queueRequest
in class ConnectionBase
Future
Response
.ClientRuntimeException
ProviderException
Future
,
ExecutionException
Copyright © 2009–2019. All rights reserved.