public class Nio2Session extends CloseableUtils.AbstractCloseable implements IoSession
CloseableUtils.AbstractCloseable.StatecloseFuture, lock, log, state| Constructor and Description |
|---|
Nio2Session(Nio2Service service,
IoHandler handler,
AsynchronousSocketChannel socket) |
| Modifier and Type | Method and Description |
|---|---|
protected CloseFuture |
doCloseGracefully() |
protected void |
doCloseImmediately()
doCloseImmediately is called once and only once
with state == Immediate
Overriding methods should always call the base implementation.
|
Object |
getAttribute(Object key)
Returns the value of the user-defined attribute of this session.
|
long |
getId()
Returns a unique identifier for this session.
|
SocketAddress |
getLocalAddress()
Returns the socket address of local machine which is associated with this
session.
|
SocketAddress |
getRemoteAddress()
Returns the socket address of remote peer.
|
IoService |
getService()
Returns the IoService that created this session.
|
Object |
setAttribute(Object key,
Object value)
Sets a user-defined attribute.
|
void |
startReading() |
void |
suspend() |
String |
toString() |
IoWriteFuture |
write(Buffer buffer)
Write a packet on the socket.
|
builder, close, isClosed, isClosing, preClosepublic Nio2Session(Nio2Service service, IoHandler handler, AsynchronousSocketChannel socket) throws IOException
IOExceptionpublic long getId()
IoSessionpublic Object getAttribute(Object key)
IoSessiongetAttribute in interface IoSessionkey - the key of the attributepublic Object setAttribute(Object key, Object value)
IoSessionsetAttribute in interface IoSessionkey - the key of the attributevalue - the value of the attributepublic SocketAddress getRemoteAddress()
IoSessiongetRemoteAddress in interface IoSessionpublic SocketAddress getLocalAddress()
IoSessiongetLocalAddress in interface IoSessionpublic void suspend()
public IoWriteFuture write(Buffer buffer)
IoSessionprotected CloseFuture doCloseGracefully()
doCloseGracefully in class CloseableUtils.AbstractCloseableprotected void doCloseImmediately()
CloseableUtils.AbstractCloseabledoCloseImmediately in class CloseableUtils.AbstractCloseablepublic IoService getService()
IoSessiongetService in interface IoSessionpublic void startReading()
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.