public class NIOSocketHandle extends AbstractNIOHandle implements SocketHandle
AbstractNIOHandle.QueuedWrite| Modifier and Type | Field and Description |
|---|---|
static int |
READ_BUFFER_SIZE |
queuedBytes, runtime, selKey, writeQueue, writeReady| Constructor and Description |
|---|
NIOSocketHandle(GenericNodeRuntime runtime) |
NIOSocketHandle(GenericNodeRuntime runtime,
java.nio.channels.SocketChannel clientChannel) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(java.lang.String address,
int port) |
void |
close() |
void |
connect(java.lang.String host,
int port,
IOCompletionHandler<java.lang.Integer> handler) |
java.net.InetSocketAddress |
getPeerName() |
IOCompletionHandler<java.nio.ByteBuffer> |
getReadHandler() |
java.net.InetSocketAddress |
getSockName() |
int |
getWritesOutstanding() |
boolean |
isServerChannel() |
void |
listen(int backlog,
IOCompletionHandler<AbstractHandle> handler) |
protected void |
processConnect() |
protected void |
processReads() |
protected void |
processWrites() |
protected void |
serverSelected(java.nio.channels.SelectionKey key) |
void |
setKeepAlive(boolean nd) |
void |
setNoDelay(boolean nd) |
void |
setReadHandler(IOCompletionHandler<java.nio.ByteBuffer> h) |
void |
shutdown(IOCompletionHandler<java.lang.Integer> handler) |
void |
startReading(IOCompletionHandler<java.nio.ByteBuffer> handler) |
void |
stopReading() |
int |
write(java.nio.ByteBuffer buf,
IOCompletionHandler<java.lang.Integer> handler) |
addInterest, clientSelected, getNetworkPolicy, queueWrite, removeInterestwrite, writeHandle, writeHandleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrite, writeHandle, writeHandlepublic static final int READ_BUFFER_SIZE
public NIOSocketHandle(GenericNodeRuntime runtime)
public NIOSocketHandle(GenericNodeRuntime runtime, java.nio.channels.SocketChannel clientChannel) throws java.io.IOException, OSException
java.io.IOExceptionOSExceptionpublic boolean isServerChannel()
public void close()
close in interface Handleclose in class AbstractHandlepublic IOCompletionHandler<java.nio.ByteBuffer> getReadHandler()
getReadHandler in interface HandlegetReadHandler in class AbstractHandlepublic void setReadHandler(IOCompletionHandler<java.nio.ByteBuffer> h)
setReadHandler in interface HandlesetReadHandler in class AbstractHandlepublic void bind(java.lang.String address,
int port)
throws OSException
bind in interface SocketHandleOSExceptionpublic void listen(int backlog,
IOCompletionHandler<AbstractHandle> handler)
throws OSException
listen in interface SocketHandleOSExceptionprotected void serverSelected(java.nio.channels.SelectionKey key)
public int write(java.nio.ByteBuffer buf,
IOCompletionHandler<java.lang.Integer> handler)
write in interface Handlewrite in class AbstractHandlepublic void shutdown(IOCompletionHandler<java.lang.Integer> handler)
shutdown in interface SocketHandlepublic int getWritesOutstanding()
getWritesOutstanding in interface HandlegetWritesOutstanding in class AbstractHandlepublic void startReading(IOCompletionHandler<java.nio.ByteBuffer> handler)
startReading in interface HandlestartReading in class AbstractHandlepublic void stopReading()
stopReading in interface HandlestopReading in class AbstractHandlepublic void connect(java.lang.String host,
int port,
IOCompletionHandler<java.lang.Integer> handler)
throws OSException
connect in interface SocketHandleOSExceptionprotected void processConnect()
processConnect in class AbstractNIOHandleprotected void processWrites()
processWrites in class AbstractNIOHandleprotected void processReads()
processReads in class AbstractNIOHandlepublic java.net.InetSocketAddress getSockName()
getSockName in interface SocketHandlepublic java.net.InetSocketAddress getPeerName()
getPeerName in interface SocketHandlepublic void setNoDelay(boolean nd)
throws OSException
setNoDelay in interface SocketHandleOSExceptionpublic void setKeepAlive(boolean nd)
throws OSException
setKeepAlive in interface SocketHandleOSExceptionCopyright © 2018 Apigee Corporation. All Rights Reserved.