org.fusesource.hawtdispatch.transport
Class TransportFilter

java.lang.Object
  extended by org.fusesource.hawtdispatch.transport.TransportFilter
All Implemented Interfaces:
Transport

public class TransportFilter
extends Object
implements Transport


Constructor Summary
TransportFilter(Transport next)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportFilter

public TransportFilter(Transport next)
Method Detail

flush

public void flush()
Description copied from interface: Transport
Forces a flush of any output buffers. Once the flush completes the listener's 'onRefill()' method will execute.

Specified by:
flush in interface Transport

full

public boolean full()
Specified by:
full in interface Transport

getBlockingExecutor

public Executor getBlockingExecutor()
Specified by:
getBlockingExecutor in interface Transport

getDispatchQueue

public DispatchQueue getDispatchQueue()
Description copied from interface: Transport
Returns the dispatch queue used by the transport

Specified by:
getDispatchQueue in interface Transport
Returns:

getLocalAddress

public SocketAddress getLocalAddress()
Specified by:
getLocalAddress in interface Transport
Returns:
the remote address for this connection

getProtocolCodec

public ProtocolCodec getProtocolCodec()
Specified by:
getProtocolCodec in interface Transport
Returns:
The protocol codec for the transport.

getReadChannel

public ReadableByteChannel getReadChannel()
Specified by:
getReadChannel in interface Transport

getRemoteAddress

public SocketAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface Transport
Returns:
the remote address for this connection

getTransportListener

public TransportListener getTransportListener()
Description copied from interface: Transport
Returns the current transport listener

Specified by:
getTransportListener in interface Transport
Returns:

getWriteChannel

public WritableByteChannel getWriteChannel()
Specified by:
getWriteChannel in interface Transport

isClosed

public boolean isClosed()
Specified by:
isClosed in interface Transport
Returns:
true if the transport is closed/stopped.

isConnected

public boolean isConnected()
Specified by:
isConnected in interface Transport
Returns:
true if the transport is connected

offer

public boolean offer(Object command)
Description copied from interface: Transport
A one way asynchronous send of a command. Only sent if the the transport is not full.

Specified by:
offer in interface Transport
Returns:
true if the command was accepted.

resumeRead

public void resumeRead()
Description copied from interface: Transport
resume delivery of commands.

Specified by:
resumeRead in interface Transport

setBlockingExecutor

public void setBlockingExecutor(Executor blockingExecutor)
Specified by:
setBlockingExecutor in interface Transport

setDispatchQueue

public void setDispatchQueue(DispatchQueue queue)
Description copied from interface: Transport
Sets the dispatch queue used by the transport

Specified by:
setDispatchQueue in interface Transport

setProtocolCodec

public void setProtocolCodec(ProtocolCodec protocolCodec)
                      throws Exception
Description copied from interface: Transport
Sets the protocol codec for the transport

Specified by:
setProtocolCodec in interface Transport
Throws:
Exception

setTransportListener

public void setTransportListener(TransportListener transportListener)
Description copied from interface: Transport
Registers an inbound command listener

Specified by:
setTransportListener in interface Transport

start

public void start(Runnable onComplete)
Description copied from interface: Transport
Starts the service. Executes the onComplete runnable once the service has fully started up.

Specified by:
start in interface Transport
Parameters:
onComplete - my be set to null if not interested in a callback.

start

public void start(Task onComplete)
Description copied from interface: Transport
Starts the service. Executes the onComplete runnable once the service has fully started up.

Specified by:
start in interface Transport
Parameters:
onComplete - my be set to null if not interested in a callback.

stop

public void stop(Runnable onComplete)
Description copied from interface: Transport
Stops the service. Executes the onComplete runnable once the service has fully stopped.

Specified by:
stop in interface Transport
Parameters:
onComplete - my be set to null if not interested in a callback.

stop

public void stop(Task onComplete)
Description copied from interface: Transport
Stops the service. Executes the onComplete runnable once the service has fully stopped.

Specified by:
stop in interface Transport
Parameters:
onComplete - my be set to null if not interested in a callback.

suspendRead

public void suspendRead()
Description copied from interface: Transport
suspend delivery of commands.

Specified by:
suspendRead in interface Transport

drainInbound

public void drainInbound()
Specified by:
drainInbound in interface Transport


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