@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 Identifiable
public Lock getLock()
IOSession
public void enqueue(Command command, Command.Priority priority)
IOSession
Command
at the end of the command queue.public boolean hasCommands()
IOSession
hasCommands
in interface IOSession
public Command poll()
IOSession
Command
from the command queue if available.public ByteChannel channel()
IOSession
public SocketAddress getLocalAddress()
IOSession
getLocalAddress
in interface IOSession
public SocketAddress getRemoteAddress()
IOSession
getRemoteAddress
in interface IOSession
public int getEventMask()
IOSession
getEventMask
in interface IOSession
public void setEventMask(int ops)
IOSession
setEventMask
in interface IOSession
ops
- new I/O event mask.public void setEvent(int op)
IOSession
public void clearEvent(int op)
IOSession
clearEvent
in interface IOSession
op
- I/O event type.public void close()
IOSession
public 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)
ModalCloseable
close
in interface ModalCloseable
closeMode
- How to close the receiver.public Timeout getSocketTimeout()
IOSession
0
signifies the session cannot time out.getSocketTimeout
in interface SocketModalCloseable
getSocketTimeout
in interface IOSession
public void setSocketTimeout(Timeout timeout)
IOSession
0
signifies the session cannot time out.
Please note this operation may affect the last event time.
setSocketTimeout
in interface SocketModalCloseable
setSocketTimeout
in interface IOSession
timeout
- socket timeout.IOSession.getLastEventTime()
public int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
IOException
public int write(ByteBuffer src) throws IOException
write
in interface WritableByteChannel
IOException
public void updateReadTime()
IOSession
updateReadTime
in interface IOSession
public void updateWriteTime()
IOSession
updateWriteTime
in interface IOSession
public long getLastReadTime()
IOSession
getLastReadTime
in interface IOSession
public long getLastWriteTime()
IOSession
getLastWriteTime
in interface IOSession
public long getLastEventTime()
IOSession
getLastEventTime
in interface IOSession
IOSession.getSocketTimeout()
public IOEventHandler getHandler()
IOSession
getHandler
in interface IOSession
public void upgrade(IOEventHandler handler)
IOSession
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.