@Internal public class LoggingIOSession extends Object implements IOSession
IOSession.Status| Constructor and Description |
|---|
LoggingIOSession(IOSession session,
org.slf4j.Logger log,
org.slf4j.Logger wireLog) |
LoggingIOSession(ProtocolIOSession session,
org.slf4j.Logger log) |
| Modifier and Type | Method and Description |
|---|---|
ByteChannel |
channel()
Returns the underlying I/O channel associated with this session.
|
void |
clearEvent(int op)
Clears interest in a particular I/O event type by updating the event
mask associated with the session.
|
void |
close()
Terminates the session gracefully and closes the underlying I/O channel.
|
void |
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated
with it.
|
void |
enqueue(Command command,
Command.Priority priority)
Inserts
Command at the end of the command queue. |
int |
getEventMask()
Returns mask of I/O evens this session declared interest in.
|
IOEventHandler |
getHandler()
Returns event handler associated with the session.
|
String |
getId() |
long |
getLastEventTime()
Returns timestamp of the last I/O event including socket timeout reset.
|
long |
getLastReadTime()
Returns timestamp of the last read event.
|
long |
getLastWriteTime()
Returns timestamp of the last write event.
|
SocketAddress |
getLocalAddress()
Returns local address.
|
Lock |
getLock()
Returns session lock that should be used by I/O event handlers
to synchronize access to the session.
|
SocketAddress |
getRemoteAddress()
Returns address of the remote peer.
|
Timeout |
getSocketTimeout()
Returns value of the socket timeout in milliseconds.
|
IOSession.Status |
getStatus()
Returns status of the session:
|
boolean |
hasCommands()
Tests if there enqueued commands pending execution.
|
boolean |
isOpen() |
Command |
poll()
Removes first
Command from the command queue if available. |
int |
read(ByteBuffer dst) |
void |
setEvent(int op)
Declares interest in a particular I/O event type by updating the event
mask associated with the session.
|
void |
setEventMask(int ops)
Declares interest in I/O event notifications by setting the event mask
associated with the session
|
void |
setSocketTimeout(Timeout timeout)
Sets value of the socket timeout in milliseconds.
|
String |
toString() |
void |
updateReadTime()
Updates the timestamp of the last read event
|
void |
updateWriteTime()
Updates the timestamp of the last write event
|
void |
upgrade(IOEventHandler handler)
Upgrades event handler associated with the session.
|
int |
write(ByteBuffer src) |
public LoggingIOSession(IOSession session, org.slf4j.Logger log, org.slf4j.Logger wireLog)
public LoggingIOSession(ProtocolIOSession session, org.slf4j.Logger log)
public String getId()
getId in interface Identifiablepublic Lock getLock()
IOSessionpublic void enqueue(Command command, Command.Priority priority)
IOSessionCommand at the end of the command queue.public boolean hasCommands()
IOSessionhasCommands in interface IOSessionpublic Command poll()
IOSessionCommand from the command queue if available.public ByteChannel channel()
IOSessionpublic SocketAddress getLocalAddress()
IOSessiongetLocalAddress in interface IOSessionpublic SocketAddress getRemoteAddress()
IOSessiongetRemoteAddress in interface IOSessionpublic int getEventMask()
IOSessiongetEventMask in interface IOSessionpublic void setEventMask(int ops)
IOSessionsetEventMask in interface IOSessionops - new I/O event mask.public void setEvent(int op)
IOSessionpublic void clearEvent(int op)
IOSessionclearEvent in interface IOSessionop - I/O event type.public void close()
IOSessionpublic IOSession.Status getStatus()
IOSession
IOSession.Status.ACTIVE: session is active.
IOSession.Status.CLOSING: session is being closed.
IOSession.Status.CLOSED: session has been terminated.
public void close(CloseMode closeMode)
ModalCloseableclose in interface ModalCloseablecloseMode - How to close the receiver.public Timeout getSocketTimeout()
IOSession0 signifies the session cannot time out.getSocketTimeout in interface SocketModalCloseablegetSocketTimeout in interface IOSessionpublic void setSocketTimeout(Timeout timeout)
IOSession0 signifies the session cannot time out.
Please note this operation may affect the last event time.
setSocketTimeout in interface SocketModalCloseablesetSocketTimeout in interface IOSessiontimeout - socket timeout.IOSession.getLastEventTime()public int read(ByteBuffer dst) throws IOException
read in interface ReadableByteChannelIOExceptionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic void updateReadTime()
IOSessionupdateReadTime in interface IOSessionpublic void updateWriteTime()
IOSessionupdateWriteTime in interface IOSessionpublic long getLastReadTime()
IOSessiongetLastReadTime in interface IOSessionpublic long getLastWriteTime()
IOSessiongetLastWriteTime in interface IOSessionpublic long getLastEventTime()
IOSessiongetLastEventTime in interface IOSessionIOSession.getSocketTimeout()public IOEventHandler getHandler()
IOSessiongetHandler in interface IOSessionpublic void upgrade(IOEventHandler handler)
IOSessionCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.