public final class PipelineConnectionBase.ResponseHandler extends java.lang.Object implements java.lang.Runnable, Connection.Listener
Runnable.
TODD: Needs to have a more regulated operating cycle. Right now its just infinite loop until something goes boom. Not good.
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicBoolean |
alive_flag |
private java.util.concurrent.atomic.AtomicReference<java.lang.Thread> |
thread |
private java.util.concurrent.atomic.AtomicBoolean |
work_flag |
| Constructor and Description |
|---|
ResponseHandler()
Adds self to the listeners of the enclosing
Connection instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
onEvent(Connection.Event event)
Needs to be hooked up.
|
void |
run()
Keeps processing the
PendingRequests in the pending Queue
until a QUIT is encountered in the pending queue. |
private void |
shutdownHandler() |
private void |
stopHandler() |
private final java.util.concurrent.atomic.AtomicBoolean work_flag
private final java.util.concurrent.atomic.AtomicBoolean alive_flag
private final java.util.concurrent.atomic.AtomicReference<java.lang.Thread> thread
public ResponseHandler()
Connection instance.public void run()
PendingRequests in the pending Queue
until a QUIT is encountered in the pending queue. Thread will stop after
processing the QUIT response (which is expected to be a VirtualResponse.
TODO: not entirely clear what is the best way to handle exceptions.
TODO: socket Reconnect in the context of pipelining is non-trivial, and maybe not even practically possible. (e.g. request n is sent but pipe breaks on some m (m!=n) response. non trivial. Perhaps its best to assume broken connection means faulted server, specially given the fact that a pipeline has a heartbeat so the issue can not be timeout.
run in interface java.lang.Runnableprivate final void stopHandler()
private final void shutdownHandler()
public void onEvent(Connection.Event event)
onEvent in interface Connection.ListenerConnection.Listener.onEvent(org.jredis.connector.Connection.Event)