Module org.glassfish.grizzly
Class TCPNIOServerConnection
java.lang.Object
org.glassfish.grizzly.nio.NIOConnection
org.glassfish.grizzly.nio.transport.TCPNIOConnection
org.glassfish.grizzly.nio.transport.TCPNIOServerConnection
- All Implemented Interfaces:
AttributeStorage,Closeable,Connection<SocketAddress>,MonitoringAware<ConnectionProbe>,OutputSink,Readable<SocketAddress>,Writeable<SocketAddress>
- Author:
- oleksiys
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classNested classes/interfaces inherited from class org.glassfish.grizzly.nio.transport.TCPNIOConnection
TCPNIOConnection.ConnectResultHandlerNested classes/interfaces inherited from interface org.glassfish.grizzly.Connection
Connection.CloseListener, Connection.CloseType -
Field Summary
Fields inherited from class org.glassfish.grizzly.nio.NIOConnection
attributes, channel, connectCloseSemaphoreUpdater, isBlocking, isStandalone, maxAsyncWriteQueueSize, monitoringConfig, NOTIFICATION_CLOSED_COMPLETE, NOTIFICATION_INITIALIZED, processor, processorSelector, readTimeoutMillis, selectionKey, selectorRunner, transport, writeTimeoutMillis, zeroByteReadCount -
Constructor Summary
ConstructorsConstructorDescriptionTCPNIOServerConnection(TCPNIOTransport transport, ServerSocketChannel serverSocketChannel) -
Method Summary
Modifier and TypeMethodDescriptionaccept()Accept aConnection.protected GrizzlyFuture<Connection>Asynchronously accept aConnectionprotected voidcloseGracefully0(CompletionHandler<Closeable> completionHandler, CloseReason closeReason) intGet the default size ofBuffers, which will be allocated for reading data fromConnection.intGet the default size ofBuffers, which will be allocated for writing data toConnection.booleanbooleanvoidlisten()voidonAccept()Method will be called by framework, when async accept will be readyvoidpreClose()protected voidvoidsetReadBufferSize(int readBufferSize) Set the default size ofBuffers, which will be allocated for reading data fromConnection.voidsetWriteBufferSize(int writeBufferSize) Set the default size ofBuffers, which will be allocated for writing data toConnection.Methods inherited from class org.glassfish.grizzly.nio.transport.TCPNIOConnection
canWrite, canWrite, checkConnectFailed, enableInitialOpRead, getLocalAddress, getPeerAddress, notifyCanWrite, notifyCanWrite, notifyReady, onConnect, onRead, onWrite, setConnectResultHandler, setSelectionKey, setSelectorRunner, terminate0, toStringMethods inherited from class org.glassfish.grizzly.nio.NIOConnection
addCloseListener, addCloseListener, assertOpen, attachToSelectorRunner, checkEmptyRead, close, close, closeFuture, closeSilently, closeWithReason, configureBlocking, configureStandalone, detachSelectorRunner, disableIOEvent, doClose, enableIOEvent, executeInEventThread, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getCloseReason, getId, getMaxAsyncWriteQueueSize, getMemoryManager, getMonitoringConfig, getProcessor, getProcessorSelector, getReadTimeout, getSelectionKey, getSelectorRunner, getTransport, getWriteTimeout, isClosed, isOpen, notifyConnectionError, notifyIOEventDisabled, notifyIOEventEnabled, notifyIOEventReady, notifyProbesAccept, notifyProbesBind, notifyProbesClose, notifyProbesConnect, notifyProbesError, notifyProbesRead, notifyProbesWrite, obtainProcessor, obtainProcessorState, read, read, removeCloseListener, removeCloseListener, setChannel, setMaxAsyncWriteQueueSize, setProcessor, setProcessorSelector, setReadTimeout, setWriteTimeout, simulateIOEvent, terminate, terminateSilently, terminateWithReason, write, write, write, write, write
-
Constructor Details
-
TCPNIOServerConnection
-
-
Method Details
-
listen
- Throws:
IOException
-
isBlocking
public boolean isBlocking()- Specified by:
isBlockingin interfaceConnection<SocketAddress>- Overrides:
isBlockingin classNIOConnection- Returns:
- the
Connectionmode. true, ifConnectionis operating in blocking mode, or false otherwise.
-
isStandalone
public boolean isStandalone()- Specified by:
isStandalonein interfaceConnection<SocketAddress>- Overrides:
isStandalonein classNIOConnection
-
accept
Accept aConnection. Could be used only in standalone mode. SeeConnection.configureStandalone(boolean).- Returns:
Future- Throws:
IOException
-
acceptAsync
Asynchronously accept aConnection- Returns:
Future- Throws:
IOException
-
preClose
public void preClose()- Overrides:
preClosein classTCPNIOConnection
-
onAccept
Method will be called by framework, when async accept will be ready- Throws:
IOException
-
setReadBufferSize
public void setReadBufferSize(int readBufferSize) Description copied from class:TCPNIOConnectionSet the default size ofBuffers, which will be allocated for reading data fromConnection. The value less or equal to zero will be ignored.- Specified by:
setReadBufferSizein interfaceConnection<SocketAddress>- Overrides:
setReadBufferSizein classTCPNIOConnection- Parameters:
readBufferSize- the default size ofBuffers, which will be allocated for reading data fromConnection.
-
setWriteBufferSize
public void setWriteBufferSize(int writeBufferSize) Description copied from class:TCPNIOConnectionSet the default size ofBuffers, which will be allocated for writing data toConnection.- Specified by:
setWriteBufferSizein interfaceConnection<SocketAddress>- Overrides:
setWriteBufferSizein classTCPNIOConnection- Parameters:
writeBufferSize- the default size ofBuffers, which will be allocated for writing data toConnection.
-
getReadBufferSize
public int getReadBufferSize()Description copied from class:TCPNIOConnectionGet the default size ofBuffers, which will be allocated for reading data fromConnection. The value less or equal to zero will be ignored.- Specified by:
getReadBufferSizein interfaceConnection<SocketAddress>- Overrides:
getReadBufferSizein classTCPNIOConnection- Returns:
- the default size of
Buffers, which will be allocated for reading data fromConnection.
-
getWriteBufferSize
public int getWriteBufferSize()Description copied from class:TCPNIOConnectionGet the default size ofBuffers, which will be allocated for writing data toConnection.- Specified by:
getWriteBufferSizein interfaceConnection<SocketAddress>- Overrides:
getWriteBufferSizein classTCPNIOConnection- Returns:
- the default size of
Buffers, which will be allocated for writing data toConnection.
-
closeGracefully0
protected void closeGracefully0(CompletionHandler<Closeable> completionHandler, CloseReason closeReason) - Overrides:
closeGracefully0in classNIOConnection
-
resetProperties
protected void resetProperties()- Overrides:
resetPropertiesin classTCPNIOConnection
-