Class HttpConnectionOverFCGI
- java.lang.Object
-
- org.eclipse.jetty.io.AbstractConnection
-
- org.eclipse.jetty.fcgi.client.http.HttpConnectionOverFCGI
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Connection
,Connection
,Attachable
public class HttpConnectionOverFCGI extends AbstractConnection implements Connection, Attachable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
HttpConnectionOverFCGI.Delegate
private static class
HttpConnectionOverFCGI.IteratorWrapper<T>
private class
HttpConnectionOverFCGI.ResponseListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,HttpChannelOverFCGI>
activeChannels
private java.lang.Object
attachment
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 RetainableByteBuffer
networkBuffer
private ClientParser
parser
private Promise<Connection>
promise
private java.util.LinkedList<java.lang.Integer>
requests
-
Constructor Summary
Constructors Constructor Description HttpConnectionOverFCGI(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise, boolean multiplexed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
abort(java.lang.Throwable failure)
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)
java.lang.Object
getAttachment()
protected Flusher
getFlusher()
HttpDestination
getHttpDestination()
boolean
isClosed()
protected HttpChannelOverFCGI
newHttpChannel(Request request)
private RetainableByteBuffer
newNetworkBuffer()
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)
(package private) void
process()
private void
reacquireNetworkBuffer()
protected void
release(HttpChannelOverFCGI channel)
private void
releaseNetworkBuffer()
private void
releaseRequest(int request)
void
send(Request request, Response.CompleteListener listener)
Sends a request with an associated response listener.protected SendFailure
send(HttpExchange exchange)
void
setAttachment(java.lang.Object obj)
Attaches the given object to this stream for later retrieval.private void
shutdown()
java.lang.String
toConnectionString()
-
Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addListener, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onClose, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toString, tryFillInterested, tryFillInterested
-
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
requests
private final java.util.LinkedList<java.lang.Integer> requests
-
activeChannels
private final java.util.Map<java.lang.Integer,HttpChannelOverFCGI> activeChannels
-
idleChannels
private final java.util.Queue<HttpChannelOverFCGI> idleChannels
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
destination
private final HttpDestination destination
-
promise
private final Promise<Connection> promise
-
multiplexed
private final boolean multiplexed
-
flusher
private final Flusher flusher
-
delegate
private final HttpConnectionOverFCGI.Delegate delegate
-
parser
private final ClientParser parser
-
networkBuffer
private RetainableByteBuffer networkBuffer
-
attachment
private java.lang.Object attachment
-
-
Constructor Detail
-
HttpConnectionOverFCGI
public HttpConnectionOverFCGI(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise, boolean multiplexed)
-
-
Method Detail
-
getHttpDestination
public HttpDestination getHttpDestination()
-
getFlusher
protected Flusher getFlusher()
-
send
public void send(Request request, Response.CompleteListener listener)
Description copied from interface:Connection
Sends a request with an associated response listener.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.- Specified by:
send
in interfaceConnection
- Parameters:
request
- the request to sendlistener
- the response listener
-
send
protected SendFailure send(HttpExchange exchange)
-
onOpen
public void onOpen()
Description copied from interface:Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpen
in interfaceConnection
- Overrides:
onOpen
in classAbstractConnection
-
onFillable
public void onFillable()
Description copied from class:AbstractConnection
Callback method invoked when the endpoint is ready to be read.
- Specified by:
onFillable
in classAbstractConnection
- See Also:
AbstractConnection.fillInterested()
-
reacquireNetworkBuffer
private void reacquireNetworkBuffer()
-
newNetworkBuffer
private RetainableByteBuffer newNetworkBuffer()
-
releaseNetworkBuffer
private void releaseNetworkBuffer()
-
process
void process()
-
parse
private boolean parse(java.nio.ByteBuffer buffer)
-
shutdown
private void shutdown()
-
onIdleExpired
public boolean onIdleExpired()
Description copied from interface: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.
- Specified by:
onIdleExpired
in interfaceConnection
- Overrides:
onIdleExpired
in classAbstractConnection
- Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
-
release
protected void release(HttpChannelOverFCGI channel)
-
close
public void close()
Description copied from interface: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 associatedEndPoint
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceConnection
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classAbstractConnection
-
close
protected void close(java.lang.Throwable failure)
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceConnection
- Returns:
- whether this connection has been closed
- See Also:
Connection.close()
-
setAttachment
public void setAttachment(java.lang.Object obj)
Description copied from interface:Attachable
Attaches the given object to this stream for later retrieval.- Specified by:
setAttachment
in interfaceAttachable
- Parameters:
obj
- the object to attach to this instance
-
getAttachment
public java.lang.Object getAttachment()
- Specified by:
getAttachment
in interfaceAttachable
- Returns:
- the object attached to this instance
- See Also:
Attachable.setAttachment(Object)
-
closeByHTTP
protected boolean closeByHTTP(HttpFields fields)
-
abort
protected void abort(java.lang.Throwable failure)
-
failAndClose
private void failAndClose(java.lang.Throwable failure)
-
acquireRequest
private int acquireRequest()
-
releaseRequest
private void releaseRequest(int request)
-
acquireHttpChannel
protected HttpChannelOverFCGI acquireHttpChannel(int id, Request request)
-
newHttpChannel
protected HttpChannelOverFCGI newHttpChannel(Request request)
-
toConnectionString
public java.lang.String toConnectionString()
- Overrides:
toConnectionString
in classAbstractConnection
-
-