Class PrefaceHandlerBase
- java.lang.Object
-
- org.apache.hc.core5.http2.impl.nio.PrefaceHandlerBase
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpConnection,HttpConnectionEventHandler,SocketModalCloseable,ModalCloseable,IOEventHandler
- Direct Known Subclasses:
ClientH2PrefaceHandler,ServerH2PrefaceHandler
abstract class PrefaceHandlerBase extends java.lang.Object implements HttpConnectionEventHandler
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleancompleted(package private) ProtocolIOSessionioSessionprivate java.util.concurrent.atomic.AtomicReference<HttpConnectionEventHandler>protocolHandlerRefprivate FutureCallback<ProtocolIOSession>resultCallback
-
Constructor Summary
Constructors Constructor Description PrefaceHandlerBase(ProtocolIOSession ioSession, FutureCallback<ProtocolIOSession> resultCallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this connection gracefully.voidclose(CloseMode closeMode)Closes this process or endpoint and releases any system resources associated with it.voiddisconnected(IOSession session)Triggered when the given session has been terminated.voidexception(IOSession session, java.lang.Exception cause)Triggered when the given session throws a exception.EndpointDetailsgetEndpointDetails()Returns this connection's endpoint details.java.net.SocketAddressgetLocalAddress()Returns this connection's local address ornullif it is not bound yet.ProtocolVersiongetProtocolVersion()Returns this connection's protocol version ornullif unknown.java.net.SocketAddressgetRemoteAddress()Returns this connection's remote address ornullif it is not connected yet or unconnected.TimeoutgetSocketTimeout()Returns the socket timeout value.javax.net.ssl.SSLSessiongetSSLSession()Returns this connection's SSL session ornullif TLS has not been activated.booleanisOpen()Checks if this connection is open.voidsetSocketTimeout(Timeout timeout)Sets the socket timeout value.(package private) voidstartProtocol(HttpConnectionEventHandler protocolHandler, java.nio.ByteBuffer data)voidtimeout(IOSession session, Timeout timeout)Triggered when the given session has timed out.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.reactor.IOEventHandler
connected, inputReady, outputReady
-
-
-
-
Field Detail
-
ioSession
final ProtocolIOSession ioSession
-
protocolHandlerRef
private final java.util.concurrent.atomic.AtomicReference<HttpConnectionEventHandler> protocolHandlerRef
-
resultCallback
private final FutureCallback<ProtocolIOSession> resultCallback
-
completed
private final java.util.concurrent.atomic.AtomicBoolean completed
-
-
Constructor Detail
-
PrefaceHandlerBase
PrefaceHandlerBase(ProtocolIOSession ioSession, FutureCallback<ProtocolIOSession> resultCallback)
-
-
Method Detail
-
startProtocol
void startProtocol(HttpConnectionEventHandler protocolHandler, java.nio.ByteBuffer data) throws java.io.IOException
- Throws:
java.io.IOException
-
timeout
public void timeout(IOSession session, Timeout timeout)
Description copied from interface:IOEventHandlerTriggered when the given session has timed out.- Specified by:
timeoutin interfaceIOEventHandler- Parameters:
session- the I/O session.timeout- the timeout.
-
exception
public void exception(IOSession session, java.lang.Exception cause)
Description copied from interface:IOEventHandlerTriggered when the given session throws a exception.- Specified by:
exceptionin interfaceIOEventHandler- Parameters:
session- the I/O session.
-
disconnected
public void disconnected(IOSession session)
Description copied from interface:IOEventHandlerTriggered when the given session has been terminated.- Specified by:
disconnectedin interfaceIOEventHandler- Parameters:
session- the I/O session.
-
getSSLSession
public javax.net.ssl.SSLSession getSSLSession()
Description copied from interface:HttpConnectionReturns this connection's SSL session ornullif TLS has not been activated.- Specified by:
getSSLSessionin interfaceHttpConnection- Returns:
- this connection's SSL session or
nullif TLS has not been activated.
-
getEndpointDetails
public EndpointDetails getEndpointDetails()
Description copied from interface:HttpConnectionReturns this connection's endpoint details.- Specified by:
getEndpointDetailsin interfaceHttpConnection- Returns:
- this connection's endpoint details.
-
setSocketTimeout
public void setSocketTimeout(Timeout timeout)
Description copied from interface:SocketModalCloseableSets the socket timeout value.- Specified by:
setSocketTimeoutin interfaceSocketModalCloseable- Parameters:
timeout- timeout value
-
getSocketTimeout
public Timeout getSocketTimeout()
Description copied from interface:SocketModalCloseableReturns the socket timeout value.- Specified by:
getSocketTimeoutin interfaceSocketModalCloseable- Returns:
- timeout value.
-
getProtocolVersion
public ProtocolVersion getProtocolVersion()
Description copied from interface:HttpConnectionReturns this connection's protocol version ornullif unknown.- Specified by:
getProtocolVersionin interfaceHttpConnection- Returns:
- this connection's protocol version or
nullif unknown.
-
getRemoteAddress
public java.net.SocketAddress getRemoteAddress()
Description copied from interface:HttpConnectionReturns this connection's remote address ornullif it is not connected yet or unconnected.- Specified by:
getRemoteAddressin interfaceHttpConnection- Returns:
- this connection's remote address or
nullif it is not connected yet or unconnected.
-
getLocalAddress
public java.net.SocketAddress getLocalAddress()
Description copied from interface:HttpConnectionReturns this connection's local address ornullif it is not bound yet.- Specified by:
getLocalAddressin interfaceHttpConnection- Returns:
- this connection's local address or
nullif it is not bound yet.
-
isOpen
public boolean isOpen()
Description copied from interface:HttpConnectionChecks if this connection is open.- Specified by:
isOpenin interfaceHttpConnection- Returns:
- true if it is open, false if it is closed.
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:HttpConnectionCloses this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Useshutdowninstead.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceHttpConnection- Throws:
java.io.IOException
-
close
public void close(CloseMode closeMode)
Description copied from interface:ModalCloseableCloses this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Specified by:
closein interfaceModalCloseable- Parameters:
closeMode- How to close the receiver.
-
-