com.sun.grizzly.nio.transport
Class TCPNIOServerConnection

java.lang.Object
  extended by com.sun.grizzly.nio.AbstractNIOConnection
      extended by com.sun.grizzly.nio.transport.TCPNIOConnection
          extended by com.sun.grizzly.nio.transport.TCPNIOServerConnection
All Implemented Interfaces:
AttributeStorage, Connection<SocketAddress>, NIOConnection, Readable<SocketAddress>, Writable<SocketAddress>, Closeable

public class TCPNIOServerConnection
extends TCPNIOConnection

Author:
oleksiys

Nested Class Summary
protected  class TCPNIOServerConnection.AcceptorEventProcessor
          EventProcessor, which will be notified, once OP_ACCEPT will be ready on ServerSockerChannel
protected  class TCPNIOServerConnection.AcceptorEventProcessorSelector
           
protected  class TCPNIOServerConnection.RegisterAcceptedChannelCompletionHandler
           
 
Field Summary
 
Fields inherited from class com.sun.grizzly.nio.AbstractNIOConnection
asyncReadQueue, asyncWriteQueue, attributes, channel, isBlocking, isClosed, processor, processorSelector, readBufferSize, selectionKey, selectorRunner, transport, writeBufferSize
 
Constructor Summary
TCPNIOServerConnection(TCPNIOTransport transport, ServerSocketChannel serverSocketChannel)
           
 
Method Summary
 Future<Connection> accept()
          Accept a Connection
protected  Future<Connection> acceptAsync()
          Asynchronously accept a Connection
 ProcessorSelector getProcessorSelector()
          Gets the default ProcessorSelector, which will be used to get Processor to process Connection I/O events, in case if this Connection's Processor is null.
 void listen()
           
 void preClose()
           
protected  void throwUnsupportReadWrite()
           
protected  boolean tryAccept()
          Check, if there are queued accept listeners.
 
Methods inherited from class com.sun.grizzly.nio.transport.TCPNIOConnection
getLocalAddress, getPeerAddress, getStreamReader, getStreamWriter, read, resetAddresses, setSelectionKey, setSelectorRunner, write
 
Methods inherited from class com.sun.grizzly.nio.AbstractNIOConnection
close, configureBlocking, disableIOEvent, enableIOEvent, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getProcessor, getReadBufferSize, getSelectionKey, getSelectorRunner, getTransport, getWriteBufferSize, isBlocking, isOpen, obtainAttributes, read, read, read, setChannel, setProcessor, setProcessorSelector, setReadBufferSize, setWriteBufferSize, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPNIOServerConnection

public TCPNIOServerConnection(TCPNIOTransport transport,
                              ServerSocketChannel serverSocketChannel)
Method Detail

listen

public void listen()
            throws IOException
Throws:
IOException

getProcessorSelector

public ProcessorSelector getProcessorSelector()
Description copied from interface: Connection
Gets the default ProcessorSelector, which will be used to get Processor to process Connection I/O events, in case if this Connection's Processor is null.

Specified by:
getProcessorSelector in interface Connection<SocketAddress>
Overrides:
getProcessorSelector in class AbstractNIOConnection
Returns:
the default ProcessorSelector, which will be used to get Processor to process Connection I/O events, in case if this Connection's Processor is null.

accept

public Future<Connection> accept()
                          throws IOException
Accept a Connection

Returns:
Future
Throws:
IOException

acceptAsync

protected Future<Connection> acceptAsync()
                                  throws IOException
Asynchronously accept a Connection

Returns:
Future
Throws:
IOException

tryAccept

protected boolean tryAccept()
                     throws IOException
Check, if there are queued accept listeners. If yes - accept the connection and notify listener, otherwise do nothing.

Returns:
true, if connection was accepted, false otherwise.
Throws:
IOException

preClose

public void preClose()
Overrides:
preClose in class TCPNIOConnection

throwUnsupportReadWrite

protected void throwUnsupportReadWrite()


Copyright © 2009 SUN Microsystems. All Rights Reserved.