org.fusesource.hawtdispatch.transport
Interface Transport

All Known Implementing Classes:
PipeTransport, SslTransport, TcpTransport, TransportFilter, UdpTransport

public interface Transport

Represents an abstract connection. It can be a client side or server side connection.

Author:
Hiram Chirino

Method Summary
 void drainInbound()
           
 void flush()
          Forces a flush of any output buffers.
 boolean full()
           
 Executor getBlockingExecutor()
           
 DispatchQueue getDispatchQueue()
          Returns the dispatch queue used by the transport
 SocketAddress getLocalAddress()
           
 ProtocolCodec getProtocolCodec()
           
 ReadableByteChannel getReadChannel()
           
 SocketAddress getRemoteAddress()
           
 TransportListener getTransportListener()
          Returns the current transport listener
 WritableByteChannel getWriteChannel()
           
 boolean isClosed()
           
 boolean isConnected()
           
 boolean offer(Object command)
          A one way asynchronous send of a command.
 void resumeRead()
          resume delivery of commands.
 void setBlockingExecutor(Executor blockingExecutor)
           
 void setDispatchQueue(DispatchQueue queue)
          Sets the dispatch queue used by the transport
 void setProtocolCodec(ProtocolCodec protocolCodec)
          Sets the protocol codec for the transport
 void setTransportListener(TransportListener transportListener)
          Registers an inbound command listener
 void start(Runnable onComplete)
          Starts the service.
 void start(Task onComplete)
          Starts the service.
 void stop(Runnable onComplete)
          Stops the service.
 void stop(Task onComplete)
          Stops the service.
 void suspendRead()
          suspend delivery of commands.
 

Method Detail

start

void start(Runnable onComplete)
Starts the service. Executes the onComplete runnable once the service has fully started up.

Parameters:
onComplete - my be set to null if not interested in a callback.

stop

void stop(Runnable onComplete)
Stops the service. Executes the onComplete runnable once the service has fully stopped.

Parameters:
onComplete - my be set to null if not interested in a callback.

start

void start(Task onComplete)
Starts the service. Executes the onComplete runnable once the service has fully started up.

Parameters:
onComplete - my be set to null if not interested in a callback.

stop

void stop(Task onComplete)
Stops the service. Executes the onComplete runnable once the service has fully stopped.

Parameters:
onComplete - my be set to null if not interested in a callback.

full

boolean full()

offer

boolean offer(Object command)
A one way asynchronous send of a command. Only sent if the the transport is not full.

Parameters:
command -
Returns:
true if the command was accepted.

flush

void flush()
Forces a flush of any output buffers. Once the flush completes the listener's 'onRefill()' method will execute.


getTransportListener

TransportListener getTransportListener()
Returns the current transport listener

Returns:

setTransportListener

void setTransportListener(TransportListener transportListener)
Registers an inbound command listener

Parameters:
transportListener -

getDispatchQueue

DispatchQueue getDispatchQueue()
Returns the dispatch queue used by the transport

Returns:

setDispatchQueue

void setDispatchQueue(DispatchQueue queue)
Sets the dispatch queue used by the transport

Parameters:
queue -

suspendRead

void suspendRead()
suspend delivery of commands.


resumeRead

void resumeRead()
resume delivery of commands.


getRemoteAddress

SocketAddress getRemoteAddress()
Returns:
the remote address for this connection

getLocalAddress

SocketAddress getLocalAddress()
Returns:
the remote address for this connection

drainInbound

void drainInbound()

isClosed

boolean isClosed()
Returns:
true if the transport is closed/stopped.

isConnected

boolean isConnected()
Returns:
true if the transport is connected

getProtocolCodec

ProtocolCodec getProtocolCodec()
Returns:
The protocol codec for the transport.

setProtocolCodec

void setProtocolCodec(ProtocolCodec protocolCodec)
                      throws Exception
Sets the protocol codec for the transport

Parameters:
protocolCodec -
Throws:
Exception

getBlockingExecutor

Executor getBlockingExecutor()

setBlockingExecutor

void setBlockingExecutor(Executor blockingExecutor)

getReadChannel

ReadableByteChannel getReadChannel()

getWriteChannel

WritableByteChannel getWriteChannel()


Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.