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.
|
SocketAddress |
getAcceptanceAddress() |
Object |
getAttribute(Object key)
Returns the value of the user-defined attribute of this session.
|
long |
getId() |
IoService |
getService() |
Object |
removeAttribute(Object key)
Removes a user-defined attribute with the specified key.
|
void |
resumeRead()
Resume read operations on this session.
|
Object |
setAttribute(Object key,
Object value)
Sets a user-defined attribute.
|
Object |
setAttributeIfAbsent(Object key,
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()
SocketAddress getAcceptanceAddress()
null if session was initiated by
this peer instead of being acceptedObject getAttribute(Object key)
key - the key of the attributenull if there is no attribute with the specified keyObject setAttribute(Object key, Object value)
key - the key of the attributevalue - the value of the attributenull if it is new.Object setAttributeIfAbsent(Object key, 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.Object removeAttribute(Object key)
key - The key of the attribute we want to removenull if not found.IoWriteFuture writeBuffer(Buffer buffer) throws 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 sentIOException - 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 IOException
IOException - If failed to shutdown the streamvoid suspendRead()
void resumeRead()
Copyright © 2018–2024 The Apache Software Foundation. All rights reserved.