Class AbstractH2IOEventHandler
- java.lang.Object
-
- org.apache.hc.core5.http2.impl.nio.AbstractH2IOEventHandler
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpConnection,HttpConnectionEventHandler,SocketModalCloseable,ModalCloseable,IOEventHandler
- Direct Known Subclasses:
ClientH2IOEventHandler,ServerH2IOEventHandler
class AbstractH2IOEventHandler extends java.lang.Object implements HttpConnectionEventHandler
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AbstractH2StreamMultiplexerstreamMultiplexer
-
Constructor Summary
Constructors Constructor Description AbstractH2IOEventHandler(AbstractH2StreamMultiplexer streamMultiplexer)
-
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.voidconnected(IOSession session)Triggered after the given session has been just created.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.voidinputReady(IOSession session, java.nio.ByteBuffer src)Triggered when the given session has input pending.booleanisOpen()Checks if this connection is open.voidoutputReady(IOSession session)Triggered when the given session is ready for output.voidsetSocketTimeout(Timeout timeout)Sets the socket timeout value.voidtimeout(IOSession session, Timeout timeout)Triggered when the given session has timed out.
-
-
-
Field Detail
-
streamMultiplexer
final AbstractH2StreamMultiplexer streamMultiplexer
-
-
Constructor Detail
-
AbstractH2IOEventHandler
AbstractH2IOEventHandler(AbstractH2StreamMultiplexer streamMultiplexer)
-
-
Method Detail
-
connected
public void connected(IOSession session) throws java.io.IOException
Description copied from interface:IOEventHandlerTriggered after the given session has been just created.- Specified by:
connectedin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
java.io.IOException
-
inputReady
public void inputReady(IOSession session, java.nio.ByteBuffer src) throws java.io.IOException
Description copied from interface:IOEventHandlerTriggered when the given session has input pending.- Specified by:
inputReadyin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
java.io.IOException
-
outputReady
public void outputReady(IOSession session) throws java.io.IOException
Description copied from interface:IOEventHandlerTriggered when the given session is ready for output.- Specified by:
outputReadyin interfaceIOEventHandler- Parameters:
session- the I/O session.- Throws:
java.io.IOException
-
timeout
public void timeout(IOSession session, Timeout timeout) throws java.io.IOException
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.- Throws:
java.io.IOException
-
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.
-
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.
-
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.
-
setSocketTimeout
public void setSocketTimeout(Timeout timeout)
Description copied from interface:SocketModalCloseableSets the socket timeout value.- Specified by:
setSocketTimeoutin interfaceSocketModalCloseable- Parameters:
timeout- timeout value
-
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.
-
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.
-
-