public abstract class Connection extends java.lang.Object implements CloseableChannel, ConnectedChannel
| Modifier and Type | Field and Description |
|---|---|
protected XnioIoThread |
thread |
EMPTY| Modifier | Constructor and Description |
|---|---|
protected |
Connection(XnioIoThread thread)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this channel.
|
protected void |
closeAction()
The close action to perform on this connection.
|
XnioIoThread |
getIoThread()
Get the I/O thread associated with this channel.
|
<A extends java.net.SocketAddress> |
getLocalAddress(java.lang.Class<A> type)
Get the local address of a given type, or
null if the address is not of that
type. |
<T> T |
getOption(Option<T> option)
Get the value of a channel option.
|
<A extends java.net.SocketAddress> |
getPeerAddress(java.lang.Class<A> type)
Get the peer address of a given type, or
null if the address is not of that
type. |
XnioWorker |
getWorker()
Get the worker for this channel.
|
boolean |
isOpen() |
boolean |
isReadShutdown()
Determine whether reads have been shut down on this connection.
|
boolean |
isWriteShutdown()
Determine whether writes have been shut down on this connection.
|
protected abstract void |
notifyReadClosed()
Indicate to conduit handlers that reads have been closed.
|
protected abstract void |
notifyWriteClosed()
Indicate to conduit handlers that writes have been closed.
|
protected boolean |
readClosed()
Indicate that reads have been closed on this connection.
|
<T> T |
setOption(Option<T> option,
T value)
Set an option for this channel.
|
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
protected boolean |
writeClosed()
Indicate that writes have been closed on this connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCloseSetter, getPeerAddressgetLocalAddressprotected final XnioIoThread thread
protected Connection(XnioIoThread thread)
thread - the I/O thread of this connectionpublic final <A extends java.net.SocketAddress> A getPeerAddress(java.lang.Class<A> type)
ConnectedChannelnull if the address is not of that
type.getPeerAddress in interface ConnectedChanneltype - the address type classnull if unknownpublic final <A extends java.net.SocketAddress> A getLocalAddress(java.lang.Class<A> type)
BoundChannelnull if the address is not of that
type.getLocalAddress in interface BoundChannelA - the address typetype - the address type classnull if unknownpublic final XnioWorker getWorker()
CloseableChannelgetWorker in interface CloseableChannelpublic XnioIoThread getIoThread()
CloseableChannelgetIoThread in interface CloseableChannelprotected boolean readClosed()
true if read closure was successfully indicated; false if this method has already been calledprotected boolean writeClosed()
true if write closure was successfully indicated; false if this method has already been calledpublic final void close()
throws java.io.IOException
CloseableChannelclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in interface java.nio.channels.InterruptibleChannelclose in interface CloseableChanneljava.io.IOException - if the close failedpublic boolean isReadShutdown()
true if reads were shut downpublic boolean isWriteShutdown()
true if writes were shut downpublic boolean isOpen()
isOpen in interface java.nio.channels.Channelprotected abstract void notifyWriteClosed()
protected abstract void notifyReadClosed()
protected void closeAction()
throws java.io.IOException
java.io.IOException - if close failspublic boolean supportsOption(Option<?> option)
ConfigurablesupportsOption in interface Configurableoption - the optiontrue if it is supportedpublic <T> T getOption(Option<T> option) throws java.io.IOException
ConfigurablegetOption in interface ConfigurableT - the type of the option valueoption - the option to getnull if it is not setjava.io.IOException - if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws java.lang.IllegalArgumentException, java.io.IOException
ConfigurablesetOption in interface ConfigurableT - the type of the option valueoption - the option to setvalue - the value of the option to setjava.lang.IllegalArgumentException - if the value is not acceptable for this optionjava.io.IOException - if an I/O error occurred when modifying the optionCopyright © 2016 JBoss, a division of Red Hat, Inc.