public class HttpConnectionOverHTTP extends AbstractConnection implements Connection, Connection.UpgradeFrom, Sweeper.Sweepable
| Modifier and Type | Class and Description |
|---|---|
private class |
HttpConnectionOverHTTP.Delegate |
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.LongAdder |
bytesIn |
private java.util.concurrent.atomic.LongAdder |
bytesOut |
private HttpChannelOverHTTP |
channel |
private java.util.concurrent.atomic.AtomicBoolean |
closed |
private HttpConnectionOverHTTP.Delegate |
delegate |
private long |
idleTimeout |
private static Logger |
LOG |
private Promise<Connection> |
promise |
private java.util.concurrent.atomic.AtomicInteger |
sweeps |
| Constructor and Description |
|---|
HttpConnectionOverHTTP(EndPoint endPoint,
HttpDestination destination,
Promise<Connection> promise) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
abort(java.lang.Throwable failure) |
protected void |
addBytesIn(long bytesIn) |
protected void |
addBytesOut(long bytesOut) |
void |
close()
Performs a logical close of this connection.
|
protected void |
close(java.lang.Throwable failure) |
long |
getBytesIn() |
long |
getBytesOut() |
HttpChannelOverHTTP |
getHttpChannel() |
HttpDestinationOverHTTP |
getHttpDestination() |
long |
getMessagesIn() |
long |
getMessagesOut() |
boolean |
isClosed() |
protected HttpChannelOverHTTP |
newHttpChannel() |
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.
|
java.nio.ByteBuffer |
onUpgradeFrom()
Takes the input buffer from the connection on upgrade.
|
void |
release() |
void |
remove() |
protected SendFailure |
send(HttpExchange exchange) |
void |
send(Request request,
Response.CompleteListener listener)
Sends a request with an associated response listener.
|
boolean |
sweep() |
java.lang.String |
toConnectionString() |
addListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onClose, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toString, tryFillInterested, tryFillInterestedprivate static final Logger LOG
private final java.util.concurrent.atomic.AtomicBoolean closed
private final java.util.concurrent.atomic.AtomicInteger sweeps
private final Promise<Connection> promise
private final HttpConnectionOverHTTP.Delegate delegate
private final HttpChannelOverHTTP channel
private long idleTimeout
private final java.util.concurrent.atomic.LongAdder bytesIn
private final java.util.concurrent.atomic.LongAdder bytesOut
public HttpConnectionOverHTTP(EndPoint endPoint, HttpDestination destination, Promise<Connection> promise)
protected HttpChannelOverHTTP newHttpChannel()
public HttpChannelOverHTTP getHttpChannel()
public HttpDestinationOverHTTP getHttpDestination()
public long getBytesIn()
getBytesIn in interface ConnectiongetBytesIn in class AbstractConnectionprotected void addBytesIn(long bytesIn)
public long getBytesOut()
getBytesOut in interface ConnectiongetBytesOut in class AbstractConnectionprotected void addBytesOut(long bytesOut)
public long getMessagesIn()
getMessagesIn in interface ConnectiongetMessagesIn in class AbstractConnectionpublic long getMessagesOut()
getMessagesOut in interface ConnectiongetMessagesOut in class AbstractConnectionpublic 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()
ConnectionCallback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen in interface ConnectiononOpen in class AbstractConnectionpublic boolean isClosed()
Connection.close()public boolean onIdleExpired()
ConnectionCallback 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 ConnectiononIdleExpired in class AbstractConnectionpublic void onFillable()
AbstractConnectionCallback method invoked when the endpoint is ready to be read.
onFillable in class AbstractConnectionAbstractConnection.fillInterested()public java.nio.ByteBuffer onUpgradeFrom()
Connection.UpgradeFromTakes the input buffer from the connection on upgrade.
This method is used to take any unconsumed input from a connection during an upgrade.
onUpgradeFrom in interface Connection.UpgradeFrompublic void release()
public void close()
ConnectionPerforms 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.Closeableclose in interface java.lang.AutoCloseableclose in interface Connectionclose in class AbstractConnectionprotected void close(java.lang.Throwable failure)
protected boolean abort(java.lang.Throwable failure)
public boolean sweep()
sweep in interface Sweeper.Sweepablepublic void remove()
public java.lang.String toConnectionString()
toConnectionString in class AbstractConnection