public abstract class Connection extends 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() |
<T> T |
getAttachment(Class<T> type)
Get a strongly-typed attachment of the given type.
|
XnioIoThread |
getIoThread()
Get the I/O thread associated with this channel.
|
<A extends SocketAddress> |
getLocalAddress(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 SocketAddress> |
getPeerAddress(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() |
boolean |
isWriteShutdown() |
protected abstract void |
notifyReadClosed() |
protected abstract void |
notifyWriteClosed() |
protected boolean |
readClosed() |
<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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCloseSetter, getPeerAddress
getLocalAddress
protected final XnioIoThread thread
protected Connection(XnioIoThread thread)
thread
- public final <A extends SocketAddress> A getPeerAddress(Class<A> type)
ConnectedChannel
null
if the address is not of that
type.getPeerAddress
in interface ConnectedChannel
type
- the address type classnull
if unknownpublic final <A extends SocketAddress> A getLocalAddress(Class<A> type)
BoundChannel
null
if the address is not of that
type.getLocalAddress
in interface BoundChannel
A
- the address typetype
- the address type classnull
if unknownpublic final XnioWorker getWorker()
CloseableChannel
getWorker
in interface CloseableChannel
public XnioIoThread getIoThread()
CloseableChannel
getIoThread
in interface CloseableChannel
protected boolean readClosed()
protected boolean writeClosed()
public final void close() throws IOException
CloseableChannel
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface CloseableChannel
IOException
- if the close failedpublic boolean isReadShutdown()
public boolean isWriteShutdown()
protected abstract void notifyWriteClosed()
protected abstract void notifyReadClosed()
protected void closeAction() throws IOException
IOException
public boolean supportsOption(Option<?> option)
Configurable
supportsOption
in interface Configurable
option
- the optiontrue
if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
Configurable
getOption
in interface Configurable
T
- the type of the option valueoption
- the option to getnull
if it is not setIOException
- if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
Configurable
setOption
in interface Configurable
T
- the type of the option valueoption
- the option to setvalue
- the value of the option to setIllegalArgumentException
- if the value is not acceptable for this optionIOException
- if an I/O error occurred when modifying the optionpublic <T> T getAttachment(Class<T> type)
null
is
returned.T
- the attachment typetype
- the attachment case class instancenull
if none matchesCopyright © 2013 JBoss by Red Hat. All rights reserved.