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>
public final class TCPNIOServerConnection extends TCPNIOConnection
- Author:
- oleksiys
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTCPNIOServerConnection.RegisterAcceptedChannelCompletionHandler-
Nested classes/interfaces inherited from class org.glassfish.grizzly.nio.transport.TCPNIOConnection
TCPNIOConnection.ConnectResultHandler
-
Nested 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
Constructors Constructor Description TCPNIOServerConnection(TCPNIOTransport transport, ServerSocketChannel serverSocketChannel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GrizzlyFuture<Connection>accept()Accept aConnection.protected GrizzlyFuture<Connection>acceptAsync()Asynchronously accept aConnectionprotected voidcloseGracefully0(CompletionHandler<Closeable> completionHandler, CloseReason closeReason)intgetReadBufferSize()Get the default size ofBuffers, which will be allocated for reading data fromConnection.intgetWriteBufferSize()Get the default size ofBuffers, which will be allocated for writing data toConnection.booleanisBlocking()booleanisStandalone()voidlisten()voidonAccept()Method will be called by framework, when async accept will be readyvoidpreClose()protected voidresetProperties()voidsetReadBufferSize(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, toString
-
Methods 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 Detail
-
TCPNIOServerConnection
public TCPNIOServerConnection(TCPNIOTransport transport, ServerSocketChannel serverSocketChannel)
-
-
Method Detail
-
listen
public void listen() throws IOException- 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
public GrizzlyFuture<Connection> accept() throws IOException
Accept aConnection. Could be used only in standalone mode. SeeConnection.configureStandalone(boolean).- Returns:
Future- Throws:
IOException
-
acceptAsync
protected GrizzlyFuture<Connection> acceptAsync() throws IOException
Asynchronously accept aConnection- Returns:
Future- Throws:
IOException
-
preClose
public void preClose()
- Overrides:
preClosein classTCPNIOConnection
-
onAccept
public void onAccept() throws IOExceptionMethod 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
-
-