org.glassfish.grizzly.nio.transport
Class TCPNIOServerConnection

java.lang.Object
  extended by org.glassfish.grizzly.nio.NIOConnection
      extended by org.glassfish.grizzly.nio.transport.TCPNIOConnection
          extended by org.glassfish.grizzly.nio.transport.TCPNIOServerConnection
All Implemented Interfaces:
AttributeStorage, Closeable<Connection>, Connection<java.net.SocketAddress>, MonitoringAware<ConnectionProbe>, Readable<java.net.SocketAddress>, Writable<java.net.SocketAddress>

public final class TCPNIOServerConnection
extends TCPNIOConnection

Author:
oleksiys

Nested Class Summary
protected  class TCPNIOServerConnection.RegisterAcceptedChannelCompletionHandler
           
 
Nested classes/interfaces inherited from interface org.glassfish.grizzly.Connection
Connection.CloseListener
 
Field Summary
 
Fields inherited from class org.glassfish.grizzly.nio.NIOConnection
asyncReadQueue, asyncWriteQueue, attributes, channel, isBlocking, isClosed, isStandalone, monitoringConfig, processor, processorSelector, readBufferSize, readTimeoutMillis, selectionKey, selectorRunner, transport, writeBufferSize, writeTimeoutMillis, zeroByteReadCount
 
Constructor Summary
TCPNIOServerConnection(TCPNIOTransport transport, java.nio.channels.ServerSocketChannel serverSocketChannel)
           
 
Method Summary
 GrizzlyFuture<Connection> accept()
          Accept a Connection.
protected  GrizzlyFuture<Connection> acceptAsync()
          Asynchronously accept a Connection
 boolean isBlocking()
           
 boolean isStandalone()
           
 void listen()
           
 void onAccept()
          Method will be called by framework, when async accept will be ready
 void preClose()
           
 void setReadBufferSize(int readBufferSize)
          Set the default size of Buffers, which will be allocated for reading data from Connection.
 void setWriteBufferSize(int writeBufferSize)
          Set the default size of Buffers, which will be allocated for writing data to Connection.
 
Methods inherited from class org.glassfish.grizzly.nio.transport.TCPNIOConnection
checkConnectFailed, getLocalAddress, getPeerAddress, onConnect, onRead, onWrite, resetProperties, setConnectCompletionHandler, setSelectionKey, setSelectorRunner, toString
 
Methods inherited from class org.glassfish.grizzly.nio.NIOConnection
addCloseListener, attachToSelectorRunner, checkEmptyRead, close, close, configureBlocking, configureStandalone, detachSelectorRunner, disableIOEvent, enableIOEvent, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getMonitoringConfig, getProcessor, getProcessorSelector, getReadBufferSize, getReadTimeout, getSelectionKey, getSelectorRunner, getTransport, getWriteBufferSize, getWriteTimeout, isOpen, notifyConnectionError, notifyIOEventDisabled, notifyIOEventEnabled, notifyIOEventReady, notifyProbesAccept, notifyProbesBind, notifyProbesClose, notifyProbesConnect, notifyProbesError, notifyProbesRead, notifyProbesWrite, obtainProcessor, read, read, removeCloseListener, setChannel, setProcessor, setProcessorSelector, setReadTimeout, setWriteTimeout, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TCPNIOServerConnection

public TCPNIOServerConnection(TCPNIOTransport transport,
                              java.nio.channels.ServerSocketChannel serverSocketChannel)
Method Detail

listen

public void listen()
            throws java.io.IOException
Throws:
java.io.IOException

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in interface Connection<java.net.SocketAddress>
Overrides:
isBlocking in class NIOConnection
Returns:
the Connection mode. true, if Connection is operating in blocking mode, or false otherwise.

isStandalone

public boolean isStandalone()
Specified by:
isStandalone in interface Connection<java.net.SocketAddress>
Overrides:
isStandalone in class NIOConnection

accept

public GrizzlyFuture<Connection> accept()
                                 throws java.io.IOException
Accept a Connection. Could be used only in standalone mode. See Connection.configureStandalone(boolean).

Returns:
Future
Throws:
java.io.IOException

acceptAsync

protected GrizzlyFuture<Connection> acceptAsync()
                                         throws java.io.IOException
Asynchronously accept a Connection

Returns:
Future
Throws:
java.io.IOException

preClose

public void preClose()
Overrides:
preClose in class TCPNIOConnection

onAccept

public void onAccept()
              throws java.io.IOException
Method will be called by framework, when async accept will be ready

Throws:
java.io.IOException

setReadBufferSize

public void setReadBufferSize(int readBufferSize)
Description copied from interface: Connection
Set the default size of Buffers, which will be allocated for reading data from Connection.

Specified by:
setReadBufferSize in interface Connection<java.net.SocketAddress>
Overrides:
setReadBufferSize in class TCPNIOConnection
Parameters:
readBufferSize - the default size of Buffers, which will be allocated for reading data from Connection.

setWriteBufferSize

public void setWriteBufferSize(int writeBufferSize)
Description copied from interface: Connection
Set the default size of Buffers, which will be allocated for writing data to Connection.

Specified by:
setWriteBufferSize in interface Connection<java.net.SocketAddress>
Overrides:
setWriteBufferSize in class TCPNIOConnection
Parameters:
writeBufferSize - the default size of Buffers, which will be allocated for writing data to Connection.


Copyright © 2011 Oracle Corpration. All Rights Reserved.