|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.AbstractTransport
com.sun.grizzly.nio.AbstractNIOTransport
com.sun.grizzly.nio.transport.TCPNIOTransport
public class TCPNIOTransport
TCP Transport NIO implementation
| Nested Class Summary | |
|---|---|
class |
TCPNIOTransport.EnableInterestPostProcessor
|
protected class |
TCPNIOTransport.RegisterChannelCompletionHandler
|
| Nested classes/interfaces inherited from interface com.sun.grizzly.Transport |
|---|
Transport.State |
| Nested classes/interfaces inherited from interface com.sun.grizzly.utils.ExceptionHandler |
|---|
ExceptionHandler.Severity |
| Field Summary | |
|---|---|
protected AsyncQueueIO |
asyncQueueIO
Transport AsyncQueueIO |
protected int |
clientSocketSoTimeout
The socket time out |
protected int |
connectionTimeout
Default channel connection timeout |
protected FilterChainFactory |
filterChainFactory
FilterChainFactory implementation |
protected int |
linger
The socket linger. |
protected TCPNIOTransport.RegisterChannelCompletionHandler |
registerChannelCompletionHandler
|
protected boolean |
reuseAddress
The socket reuseAddress |
protected Collection<TCPNIOServerConnection> |
serverConnections
The Server connections. |
protected int |
serverSocketSoTimeout
The server socket time out |
protected boolean |
tcpNoDelay
The socket tcpDelay. |
protected TemporarySelectorIO |
temporarySelectorIO
Server socket backlog. |
| Fields inherited from class com.sun.grizzly.nio.AbstractNIOTransport |
|---|
nioChannelDistributor, selectionKeyHandler, selectorHandler, selectorRunners, selectorRunnersCount |
| Fields inherited from class com.sun.grizzly.AbstractTransport |
|---|
attributeBuilder, exceptionHandlers, internalThreadPool, isBlocking, memoryManager, name, processor, processorSelector, readBufferSize, state, strategy, workerThreadPool, writeBufferSize |
| Constructor Summary | |
|---|---|
|
TCPNIOTransport()
|
protected |
TCPNIOTransport(String name)
|
| Method Summary | |
|---|---|
TCPNIOServerConnection |
bind(int port)
Binds Transport to the specific port on localhost. |
TCPNIOServerConnection |
bind(SocketAddress socketAddress)
Binds Transport to the specific SocketAddress. |
TCPNIOServerConnection |
bind(SocketAddress socketAddress,
int backlog)
Binds Transport to the specific SocketAddress. |
TCPNIOServerConnection |
bind(String host,
int port)
Binds Transport to the specific host and port. |
TCPNIOServerConnection |
bind(String host,
int port,
int backlog)
Binds Transport to the specific host and port. |
protected void |
closeConnection(Connection connection)
Close the connection, managed by Transport |
protected void |
configureChannel(SocketChannel channel)
Configuring SocketChannel according the transport settings |
Future<Connection> |
connect(SocketAddress remoteAddress)
Creates, initializes and connects socket to the specific SocketAddress and returns Connection, representing socket. |
Future<Connection> |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Creates, initializes socket, binds it to the specific local and remote SocketAddress and returns Connection, representing socket. |
Future<Connection> |
connect(String host,
int port)
Creates, initializes and connects socket to the specific remote host and port and returns Connection, representing socket. |
protected void |
executeProcessor(IOEvent ioEvent,
Connection connection,
Processor processor,
ProcessorExecutor executor,
PostProcessor postProcessor,
Object strategyContext)
|
void |
fireIOEvent(IOEvent ioEvent,
Connection connection,
Object strategyContext)
Fires specific IOEvent on the Connection |
AsyncQueueIO |
getAsyncQueueIO()
Get asynchronous queue implementation. |
int |
getClientSocketSoTimeout()
|
int |
getConnectionTimeout()
|
FilterChain |
getFilterChain()
Get FilterChain instance. |
FilterChainFactory |
getFilterChainFactory()
Get FilterChainFactory, responsible to construct
FilterChain instance. |
int |
getLinger()
|
Filter |
getMessageTransportFilter()
Get transport Filter, which is aware of Transport
specifics; knows how to read/write from/to Transport. |
int |
getServerSocketSoTimeout()
|
Filter |
getStreamTransportFilter()
Get transport Filter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connection streams. |
TemporarySelectorIO |
getTemporarySelectorIO()
|
boolean |
isReuseAddress()
|
boolean |
isTcpNoDelay()
|
protected NIOConnection |
obtainNIOConnection(SocketChannel channel)
|
void |
pause()
Pauses the transport |
int |
read(Connection connection,
Buffer buffer)
|
int |
read(Connection connection,
Buffer buffer,
ReadResult currentResult)
|
void |
resume()
Resumes the transport after a pause |
void |
setClientSocketSoTimeout(int socketTimeout)
|
void |
setConnectionTimeout(int connectionTimeout)
|
void |
setFilterChainFactory(FilterChainFactory factory)
Set FilterChainFactory, responsible to construct
FilterChain instance. |
void |
setLinger(int linger)
|
void |
setReuseAddress(boolean reuseAddress)
|
void |
setServerSocketSoTimeout(int serverSocketSoTimeout)
|
void |
setTcpNoDelay(boolean tcpNoDelay)
|
void |
setTemporarySelectorIO(TemporarySelectorIO temporarySelectorIO)
|
void |
start()
Starts the transport |
void |
stop()
Stops the transport and closes all the connections |
void |
unbind(Connection connection)
Unbinds bound Transport connection. |
void |
unbindAll()
Unbinds all bound Transport connections. |
int |
write(Connection connection,
Buffer buffer)
|
int |
write(Connection connection,
Buffer buffer,
WriteResult currentResult)
|
| Methods inherited from class com.sun.grizzly.nio.AbstractNIOTransport |
|---|
getNioChannelDistributor, getSelectionKeyHandler, getSelectorHandler, getSelectorRunners, getSelectorRunnersCount, setNioChannelDistributor, setSelectionKeyHandler, setSelectorHandler, setSelectorRunnersCount, startSelectorRunners, stopSelectorRunners |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.grizzly.SocketConnectorHandler |
|---|
getProcessor, getProcessorSelector, setProcessor, setProcessorSelector |
| Methods inherited from interface com.sun.grizzly.nio.NIOTransport |
|---|
getStrategy, setStrategy |
| Field Detail |
|---|
protected final Collection<TCPNIOServerConnection> serverConnections
protected FilterChainFactory filterChainFactory
protected AsyncQueueIO asyncQueueIO
protected TemporarySelectorIO temporarySelectorIO
protected int serverSocketSoTimeout
protected boolean tcpNoDelay
protected boolean reuseAddress
protected int linger
protected int clientSocketSoTimeout
protected int connectionTimeout
protected final TCPNIOTransport.RegisterChannelCompletionHandler registerChannelCompletionHandler
| Constructor Detail |
|---|
public TCPNIOTransport()
protected TCPNIOTransport(String name)
| Method Detail |
|---|
public void start()
throws IOException
AbstractTransport
start in interface Transportstart in class AbstractTransportIOException
public void stop()
throws IOException
AbstractTransport
stop in interface Transportstop in class AbstractTransportIOException
public void pause()
throws IOException
AbstractTransport
pause in interface Transportpause in class AbstractTransportIOException
public void resume()
throws IOException
AbstractTransport
resume in interface Transportresume in class AbstractTransportIOException
public TCPNIOServerConnection bind(int port)
throws IOException
bind in interface SocketBinderConnection
IOException
public TCPNIOServerConnection bind(String host,
int port)
throws IOException
bind in interface SocketBinderhost - the local host the server will bind to
Connection
IOException
public TCPNIOServerConnection bind(String host,
int port,
int backlog)
throws IOException
bind in interface SocketBinderhost - the local host the server will bind tobacklog - the maximum length of the queue
Connection
IOException
public TCPNIOServerConnection bind(SocketAddress socketAddress)
throws IOException
bind in interface SocketBindersocketAddress - the local address the server will bind to
Connection
IOException
public TCPNIOServerConnection bind(SocketAddress socketAddress,
int backlog)
throws IOException
bind in interface SocketBindersocketAddress - the local address the server will bind tobacklog - the maximum length of the queue
Connection
IOException
public void unbind(Connection connection)
throws IOException
Transport connection.
unbind in interface SocketBinderIOException
public void unbindAll()
throws IOException
SocketBinderTransport connections.
unbindAll in interface SocketBinderIOException
public Future<Connection> connect(String host,
int port)
throws IOException
SocketConnectorHandlerConnection, representing socket.
connect in interface SocketConnectorHandlerhost - remote host to connect to.port - remote port to connect to.
Future of connect operation, which could be used to get
resulting Connection.
IOException
public Future<Connection> connect(SocketAddress remoteAddress)
throws IOException
SocketConnectorHandlerSocketAddress and returns Connection, representing socket.
connect in interface SocketConnectorHandlerremoteAddress - remote address to connect to.
Future of connect operation, which could be used to get
resulting Connection.
IOException
public Future<Connection> connect(SocketAddress remoteAddress,
SocketAddress localAddress)
throws IOException
SocketConnectorHandlerSocketAddress and returns Connection, representing socket.
connect in interface SocketConnectorHandlerremoteAddress - remote address to connect to.localAddress - local address to bind socket to.
Future of connect operation, which could be used to get
resulting Connection.
IOException
protected void closeConnection(Connection connection)
throws IOException
AbstractTransport
closeConnection in class AbstractNIOTransportIOExceptionprotected NIOConnection obtainNIOConnection(SocketChannel channel)
protected void configureChannel(SocketChannel channel)
throws IOException
SocketChannel according the transport settings
channel - SocketChannel to configure
IOExceptionpublic AsyncQueueIO getAsyncQueueIO()
AsyncQueueEnabledTransport
getAsyncQueueIO in interface AsyncQueueEnabledTransportpublic int getLinger()
public void setLinger(int linger)
public boolean isReuseAddress()
public void setReuseAddress(boolean reuseAddress)
public int getClientSocketSoTimeout()
public void setClientSocketSoTimeout(int socketTimeout)
public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
public boolean isTcpNoDelay()
public void setTcpNoDelay(boolean tcpNoDelay)
public int getServerSocketSoTimeout()
public void setServerSocketSoTimeout(int serverSocketSoTimeout)
public FilterChainFactory getFilterChainFactory()
FilterChainEnabledTransportFilterChainFactory, responsible to construct
FilterChain instance.
getFilterChainFactory in interface FilterChainEnabledTransportFilterChainFactory, responsible to construct
FilterChain instance.public void setFilterChainFactory(FilterChainFactory factory)
FilterChainEnabledTransportFilterChainFactory, responsible to construct
FilterChain instance.
setFilterChainFactory in interface FilterChainEnabledTransportfactory - FilterChainFactory, responsible to construct
FilterChain instance.public FilterChain getFilterChain()
FilterChainEnabledTransportFilterChain instance.
getFilterChain in interface FilterChainEnabledTransportFilterChain instance.public Filter getStreamTransportFilter()
FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connection streams.
This Filter is used, if FilterChain supposed to work
in stream mode.
Each Transport should provide stream transport Filter
implementation.
getStreamTransportFilter in interface FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connection streams.public Filter getMessageTransportFilter()
FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport.
This Filter is used, if FilterChain supposed to work
in message mode.
Each Transport should provide stream transport Filter
implementation.
getMessageTransportFilter in interface FilterChainEnabledTransportFilter, which is aware of Transport
specifics; knows how to read/write from/to Transport
specific Connections.public TemporarySelectorIO getTemporarySelectorIO()
getTemporarySelectorIO in interface TemporarySelectorsEnabledTransportpublic void setTemporarySelectorIO(TemporarySelectorIO temporarySelectorIO)
setTemporarySelectorIO in interface TemporarySelectorsEnabledTransport
public void fireIOEvent(IOEvent ioEvent,
Connection connection,
Object strategyContext)
throws IOException
TransportIOEvent on the Connection
fireIOEvent in interface TransportioEvent - I/O eventconnection - Connection, on which we fire the event.strategyContext - Strategy state
IOException
protected void executeProcessor(IOEvent ioEvent,
Connection connection,
Processor processor,
ProcessorExecutor executor,
PostProcessor postProcessor,
Object strategyContext)
throws IOException
IOException
public int read(Connection connection,
Buffer buffer)
throws IOException
IOException
public int read(Connection connection,
Buffer buffer,
ReadResult currentResult)
throws IOException
IOException
public int write(Connection connection,
Buffer buffer)
throws IOException
IOException
public int write(Connection connection,
Buffer buffer,
WriteResult currentResult)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||