public class Session
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
Session.ArrayQueueItem |
static class |
Session.QueueItem |
| Modifier and Type | Field and Description |
|---|---|
static int |
ACTIVE |
protected boolean |
closing |
static int |
CLOSING |
static int |
EVENT_MASK |
protected int |
events |
protected int |
eventsToListen |
static int |
IDLE |
protected long |
lastAccessTime |
protected static org.slf4j.Logger |
log |
protected Session.QueueItem |
queueHead |
static int |
READABLE |
protected Selector |
selector |
protected int |
slot |
protected Socket |
socket |
static int |
SSL |
static int |
STALE |
protected boolean |
wasSelected |
static int |
WRITEABLE |
| Constructor and Description |
|---|
Session(Socket socket) |
Session(Socket socket,
int eventsToListen) |
| Modifier and Type | Method and Description |
|---|---|
int |
checkStatus(long currentTime,
long keepAlive) |
void |
close() |
void |
getQueueStats(long[] stats) |
java.lang.String |
getRemoteHost() |
void |
handleException(java.lang.Throwable e) |
boolean |
isSsl() |
long |
lastAccessTime() |
void |
listen(int newEventsToListen) |
void |
process(byte[] buffer) |
protected void |
processRead(byte[] buffer) |
protected void |
processWrite() |
int |
read(byte[] data,
int offset,
int count) |
int |
readRaw(long address,
int count) |
void |
scheduleClose() |
Socket |
socket() |
void |
write(byte[] data,
int offset,
int count) |
void |
write(byte[] data,
int offset,
int count,
int flags) |
void |
write(Session.QueueItem item) |
protected static final org.slf4j.Logger log
public static final int READABLE
public static final int WRITEABLE
public static final int CLOSING
public static final int EVENT_MASK
public static final int SSL
public static final int ACTIVE
public static final int IDLE
public static final int STALE
protected Socket socket
protected Selector selector
protected int slot
protected int events
protected int eventsToListen
protected boolean wasSelected
protected boolean closing
protected Session.QueueItem queueHead
protected volatile long lastAccessTime
public Session(Socket socket)
public Session(Socket socket, int eventsToListen)
public final java.lang.String getRemoteHost()
public final Socket socket()
public final long lastAccessTime()
public boolean isSsl()
public int checkStatus(long currentTime,
long keepAlive)
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void scheduleClose()
public void getQueueStats(long[] stats)
public void listen(int newEventsToListen)
public int read(byte[] data,
int offset,
int count)
throws java.io.IOException
java.io.IOExceptionpublic int readRaw(long address,
int count)
throws java.io.IOException
java.io.IOExceptionpublic final void write(byte[] data,
int offset,
int count)
throws java.io.IOException
java.io.IOExceptionpublic final void write(byte[] data,
int offset,
int count,
int flags)
throws java.io.IOException
java.io.IOExceptionpublic final void write(Session.QueueItem item) throws java.io.IOException
java.io.IOExceptionprotected void processRead(byte[] buffer)
throws java.lang.Exception
java.lang.Exceptionprotected void processWrite()
throws java.lang.Exception
java.lang.Exceptionpublic void process(byte[] buffer)
throws java.lang.Exception
java.lang.Exceptionpublic void handleException(java.lang.Throwable e)