public class ChunkedPipelineConnection extends ConnectionBase
intended to replace existing pipeline per further tests. This pipeline:
Design:
We're basically delegating output throttling concerns to the OS and the TCP/IP layer using blocking write semantics. The TCP layer will write MTU sized packets, regardless of actual user data, so clearly the more we pack per packet, the higher will be the throughput of the connector.
Modifier and Type | Class and Description |
---|---|
class |
ChunkedPipelineConnection.ResponseHandler
Provides the response processing logic as a
Runnable . |
Connection.Event, Connection.Factory, Connection.Flag, Connection.Listener, Connection.Modality, Connection.Property, Connection.Socket, Connection.State
spec
Constructor and Description |
---|
ChunkedPipelineConnection(ConnectionSpec spec) |
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
notifyConnected()
Extension point -- callback on this method when
ConnectionBase has connected to server. |
protected void |
notifyDisconnected()
Extension point -- callback on this method when
ConnectionBase has disconnected from server. |
Future<Response> |
queueRequest(Command cmd,
byte[]... args)
This is a true asynchronous method.
|
addListener, connect, disconnect, getInputStream, getOutputStream, getProtocolHandler, getSpec, initializeAsyncConnection, initializeOnConnect, initializeSocketStreams, initializeSyncConnection, isConnected, newOutputStream, notifyFaulted, notifyListeners, notifyShuttingDown, onConnectionFault, reconnect, removeListener, serviceRequest, shutdown, toString
public ChunkedPipelineConnection(ConnectionSpec spec) throws ClientRuntimeException
spec
- ClientRuntimeException
protected void initializeComponents()
ConnectionBase
In the extended class:
protected void initializeComponents() {
super.initializeComponents();
// my components here ...
//
}
initializeComponents
in class ConnectionBase
protected void notifyConnected()
ConnectionBase
ConnectionBase
has connected to server.
It is important to note that the extension must call super.notifyConnected if reliable service (using
heartbeats) is required!.notifyConnected
in class ConnectionBase
protected void notifyDisconnected()
ConnectionBase
ConnectionBase
has disconnected from server.
It is important to note that the extension must call super.notifyDisconnected if reliable service (using
heartbeats) is required!.notifyDisconnected
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 Future<Response> queueRequest(Command cmd, byte[]... args) throws ClientRuntimeException, ProviderException
Command.CONN_FLUSH
.
Other item of note is that once a QUIT request has been queued, no further requests are accepted and a ClientRuntimeException is thrown.
queueRequest
in interface Connection
queueRequest
in class ConnectionBase
Future
Response
.ClientRuntimeException
ProviderException
ConnectionBase.queueRequest(org.jredis.protocol.Command, byte[][])
Copyright © 2009–2017. All rights reserved.