|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.maverick.nio.SocketConnection
public class SocketConnection
This class implements a SocketHandler using a standard socket.
| Field Summary | |
|---|---|
protected boolean |
closed
|
protected Daemon |
daemon
|
protected DaemonContext |
daemonContext
|
protected java.nio.channels.SelectionKey |
key
|
protected ProtocolEngine |
protocolEngine
|
protected SelectorThread |
selectorThread
|
protected java.nio.channels.SocketChannel |
socketChannel
|
protected java.nio.ByteBuffer |
socketDataIn
|
protected java.nio.ByteBuffer |
socketDataOut
|
| Constructor Summary | |
|---|---|
SocketConnection()
Construct the socket. |
|
| Method Summary | |
|---|---|
void |
closeConnection()
Close this socket connection. |
DaemonContext |
getDaemonContext()
Get the daemon process for this socket. |
IdleStateManager |
getIdleStates()
Get the idle state manager. |
int |
getInterestedOps()
Get the initial interested ops for this socket. |
java.net.SocketAddress |
getLocalAddress()
Returns the local address to which the remote socket is connected. |
int |
getLocalPort()
Returns the local port to which the remote socket is connected. |
int |
getPort()
Returns the local port to which the remote socket is connected. |
ProtocolEngine |
getProtocolEngine()
Get the protocol engine for this socket. |
java.net.SocketAddress |
getRemoteAddress()
Returns the address of the remote socket. |
java.nio.channels.SocketChannel |
getSocketChannel()
Get the SocketChannel for this socket. |
SelectorThread |
getThread()
Get the selector thread for this connection |
void |
initialize(ProtocolEngine protocolEngine,
Daemon daemon)
Initialize the socket with the protocol engine and the daemon process. |
protected boolean |
isConnected()
Is the socket still connected? |
boolean |
isSelectorThread()
Is the current thread this sockets SelectorThread? |
boolean |
processReadEvent()
The selector is ready to be read. |
boolean |
processWriteEvent()
The selector is ready to be written to. |
void |
registrationCompleted(java.nio.channels.SelectableChannel channel,
java.nio.channels.SelectionKey key,
SelectorThread selectorThread)
The sockets channel has completed registration. |
void |
setThread(SelectorThread thread)
Set the selector thread for this connection |
void |
setWriteState(boolean wantsWrite)
Sets the write state of the socket. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.nio.channels.SocketChannel socketChannel
protected ProtocolEngine protocolEngine
protected DaemonContext daemonContext
protected SelectorThread selectorThread
protected java.nio.channels.SelectionKey key
protected Daemon daemon
protected java.nio.ByteBuffer socketDataIn
protected java.nio.ByteBuffer socketDataOut
protected boolean closed
| Constructor Detail |
|---|
public SocketConnection()
| Method Detail |
|---|
public void initialize(ProtocolEngine protocolEngine,
Daemon daemon)
initialize in interface SocketHandlerprotocolEngine - ProtocolEnginedaemon - Daemon
public void registrationCompleted(java.nio.channels.SelectableChannel channel,
java.nio.channels.SelectionKey key,
SelectorThread selectorThread)
registrationCompleted in interface SelectorRegistrationListenerchannel - SelectableChannelkey - SelectionKeyselectorThread - SelectorThreadpublic void closeConnection()
public ProtocolEngine getProtocolEngine()
public DaemonContext getDaemonContext()
public java.net.SocketAddress getLocalAddress()
public int getLocalPort()
public int getPort()
public java.net.SocketAddress getRemoteAddress()
public java.nio.channels.SocketChannel getSocketChannel()
public IdleStateManager getIdleStates()
public boolean isSelectorThread()
SelectorThread?
public void setWriteState(boolean wantsWrite)
wantsWrite - booleanprotected boolean isConnected()
public SelectorThread getThread()
public int getInterestedOps()
getInterestedOps in interface SocketHandlerpublic boolean processReadEvent()
processReadEvent in interface SocketHandlerpublic boolean processWriteEvent()
processWriteEvent in interface SocketHandlerpublic void setThread(SelectorThread thread)
setThread in interface SocketHandlerthread - SelectorThread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||