public class FaultedConnection extends Object implements Connection
FaultedConnection
is a support class for implementors of JRedis API.Connection.Event, Connection.Factory, Connection.Flag, Connection.Listener, Connection.Modality, Connection.Property, Connection.Socket, Connection.State
Constructor and Description |
---|
FaultedConnection(ConnectionSpec connSpec,
String errMsg)
instantiates a faulted connection for the given
ConnectionSpec |
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(Connection.Listener connListener)
Connection.Event propagation.
|
ConnectionSpec |
getSpec()
The
ConnectionSpec of a Connection must be invariant during its life-cycle. |
Future<Response> |
queueRequest(Command cmd,
byte[]... args)
A non-blocking call to service the specified request at some point in the future.
|
boolean |
removeListener(Connection.Listener connListener)
Optional event propagation method.
|
Response |
serviceRequest(Command cmd,
byte[]... args)
A blocking call to service the specified request.
|
public FaultedConnection(ConnectionSpec connSpec, String errMsg)
ConnectionSpec
connSpec
- errMsg
- public ConnectionSpec getSpec()
Connection
ConnectionSpec
of a Connection must be invariant during its life-cycle.getSpec
in interface Connection
ConnectionSpec
for this Connection.public Response serviceRequest(Command cmd, byte[]... args) throws RedisException, ClientRuntimeException, ProviderException
Connection
Protocol
interface
and can (and should) be addressed at the implementation level (for example when creating
handler instances using a specification set, including max wait for synchronous response.)
Connection.Modality.Asynchronous
handlers must always throw a ClientRuntimeException
for this method which violates the contract for Connection.Modality.Asynchronous
handlers.
serviceRequest
in interface Connection
RedisException
ClientRuntimeException
ProviderException
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
Future
Response
.ClientRuntimeException
ProviderException
Future
,
ExecutionException
public final boolean addListener(Connection.Listener connListener)
Connection
addListener
in interface Connection
public final boolean removeListener(Connection.Listener connListener)
Connection
Connection.Listener
s.removeListener
in interface Connection
Copyright © 2009–2019. All rights reserved.