public interface IoSession extends ConnectionEndpointsIndicator, Closeable
| Modifier and Type | Method and Description |
|---|---|
CloseFuture |
close(boolean immediately)
Closes this session immediately or after all queued write requests are flushed.
|
java.net.SocketAddress |
getAcceptanceAddress() |
java.lang.Object |
getAttribute(java.lang.Object key)
Returns the value of the user-defined attribute of this session.
|
long |
getId() |
IoService |
getService() |
java.lang.Object |
removeAttribute(java.lang.Object key)
Removes a user-defined attribute with the specified key.
|
void |
resumeRead()
Resume read operations on this session.
|
java.lang.Object |
setAttribute(java.lang.Object key,
java.lang.Object value)
Sets a user-defined attribute.
|
java.lang.Object |
setAttributeIfAbsent(java.lang.Object key,
java.lang.Object value)
Sets a user defined attribute if the attribute with the specified key is not set yet.
|
void |
shutdownOutputStream()
Handle received EOF.
|
void |
suspendRead()
Suspend read operations on this session.
|
IoWriteFuture |
writeBuffer(Buffer buffer)
Write a packet on the socket.
|
getLocalAddress, getRemoteAddressaddCloseFutureListener, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerlong getId()
java.net.SocketAddress getAcceptanceAddress()
null if session was initiated by
this peer instead of being acceptedjava.lang.Object getAttribute(java.lang.Object key)
key - the key of the attributenull if there is no attribute with the specified keyjava.lang.Object setAttribute(java.lang.Object key,
java.lang.Object value)
key - the key of the attributevalue - the value of the attributenull if it is new.java.lang.Object setAttributeIfAbsent(java.lang.Object key,
java.lang.Object value)
if (containsAttribute(key)) {
return getAttribute(key);
} else {
return setAttribute(key, value);
}
key - The key of the attribute we want to setvalue - The value we want to setnull if not found.java.lang.Object removeAttribute(java.lang.Object key)
key - The key of the attribute we want to removenull if not found.IoWriteFuture writeBuffer(Buffer buffer) throws java.io.IOException
buffer - the buffer send. NOTE: the buffer must not be touched until the returned write future
is completed.IoWriteFuture that can be used to check when the packet has actually been sentjava.io.IOException - if an error occurred when sending the packetCloseFuture close(boolean immediately)
CloseFuture if you want to wait for the session actually closed.immediately - true to close this session immediately. The pending write requests will simply be
discarded. false to close this session after all queued write requests are flushed.CloseFuturevoid shutdownOutputStream()
throws java.io.IOException
java.io.IOException - If failed to shutdown the streamvoid suspendRead()
void resumeRead()