public class HttpConnectionOverFCGI extends AbstractConnection implements Connection
Modifier and Type | Class and Description |
---|---|
private class |
HttpConnectionOverFCGI.Delegate |
private class |
HttpConnectionOverFCGI.ResponseListener |
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,HttpChannelOverFCGI> |
activeChannels |
private java.nio.ByteBuffer |
buffer |
private java.util.concurrent.atomic.AtomicBoolean |
closed |
private HttpConnectionOverFCGI.Delegate |
delegate |
private HttpDestination |
destination |
private Flusher |
flusher |
private java.util.Queue<HttpChannelOverFCGI> |
idleChannels |
private static Logger |
LOG |
private boolean |
multiplexed |
private ClientParser |
parser |
private Promise<Connection> |
promise |
private java.util.LinkedList<java.lang.Integer> |
requests |
Constructor and Description |
---|
HttpConnectionOverFCGI(EndPoint endPoint,
HttpDestination destination,
Promise<Connection> promise,
boolean multiplexed) |
Modifier and Type | Method and Description |
---|---|
protected void |
abort(java.lang.Throwable failure) |
private java.nio.ByteBuffer |
acquireBuffer() |
protected HttpChannelOverFCGI |
acquireHttpChannel(int id,
Request request) |
private int |
acquireRequest() |
void |
close()
Performs a logical close of this connection.
|
protected void |
close(java.lang.Throwable failure) |
protected boolean |
closeByHTTP(HttpFields fields) |
private void |
failAndClose(java.lang.Throwable failure) |
protected Flusher |
getFlusher() |
HttpDestination |
getHttpDestination() |
boolean |
isClosed() |
protected HttpChannelOverFCGI |
newHttpChannel(Request request) |
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
boolean |
onIdleExpired()
Callback method invoked upon an idle timeout event.
|
void |
onOpen()
Callback method invoked when this connection is opened.
|
private boolean |
parse(java.nio.ByteBuffer buffer) |
private void |
process(java.nio.ByteBuffer buffer) |
protected void |
release(HttpChannelOverFCGI channel) |
private void |
releaseBuffer(java.nio.ByteBuffer buffer) |
private void |
releaseRequest(int request) |
protected SendFailure |
send(HttpExchange exchange) |
void |
send(Request request,
Response.CompleteListener listener)
Sends a request with an associated response listener.
|
private void |
shutdown() |
java.lang.String |
toConnectionString() |
addListener, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onClose, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toString, tryFillInterested, tryFillInterested
private static final Logger LOG
private final java.util.LinkedList<java.lang.Integer> requests
private final java.util.Map<java.lang.Integer,HttpChannelOverFCGI> activeChannels
private final java.util.Queue<HttpChannelOverFCGI> idleChannels
private final java.util.concurrent.atomic.AtomicBoolean closed
private final HttpDestination destination
private final Promise<Connection> promise
private final boolean multiplexed
private final Flusher flusher
private final HttpConnectionOverFCGI.Delegate delegate
private final ClientParser parser
private java.nio.ByteBuffer buffer
public HttpConnectionOverFCGI(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise, boolean multiplexed)
public HttpDestination getHttpDestination()
protected Flusher getFlusher()
public void send(Request request, Response.CompleteListener listener)
Connection
Request.send(Response.CompleteListener)
will eventually call this method to send the request.
It is exposed to allow applications to send requests via unpooled connections.
request
- the request to sendlistener
- the response listenerprotected SendFailure send(HttpExchange exchange)
public void onOpen()
Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen
in interface Connection
onOpen
in class AbstractConnection
public void onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
private java.nio.ByteBuffer acquireBuffer()
private void releaseBuffer(java.nio.ByteBuffer buffer)
private void process(java.nio.ByteBuffer buffer)
private boolean parse(java.nio.ByteBuffer buffer)
private void shutdown()
public boolean onIdleExpired()
Connection
Callback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
onIdleExpired
in interface Connection
onIdleExpired
in class AbstractConnection
protected void release(HttpChannelOverFCGI channel)
public void close()
Connection
Performs a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint
but, for example, SSL connections should write the SSL close message
before closing the associated EndPoint
.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Connection
close
in class AbstractConnection
protected void close(java.lang.Throwable failure)
public boolean isClosed()
Connection.close()
protected boolean closeByHTTP(HttpFields fields)
protected void abort(java.lang.Throwable failure)
private void failAndClose(java.lang.Throwable failure)
private int acquireRequest()
private void releaseRequest(int request)
protected HttpChannelOverFCGI acquireHttpChannel(int id, Request request)
protected HttpChannelOverFCGI newHttpChannel(Request request)
public java.lang.String toConnectionString()
toConnectionString
in class AbstractConnection