org.fusesource.hawtdispatch.transport
Class TcpTransportServer

java.lang.Object
  extended by org.fusesource.hawtdispatch.transport.TcpTransportServer
All Implemented Interfaces:
TransportServer
Direct Known Subclasses:
SslTransportServer

public class TcpTransportServer
extends Object
implements TransportServer

A TCP based implementation of TransportServer

Author:
Hiram Chirino

Constructor Summary
TcpTransportServer(URI location)
           
 
Method Summary
protected  TcpTransport createTransport()
           
 int getBacklog()
           
 String getBoundAddress()
           
 String getConnectAddress()
           
 DispatchQueue getDispatchQueue()
          Returns the dispatch queue used by the transport
 int getReceive_buffer_size()
           
 InetSocketAddress getSocketAddress()
           
protected  void handleSocket(SocketChannel socket)
           
protected  String resolveHostName()
           
 void resume()
          resume accepting new transports
 void setBacklog(int backlog)
           
 void setDispatchQueue(DispatchQueue dispatchQueue)
          Sets the dispatch queue used by the transport
 void setReceive_buffer_size(int receive_buffer_size)
           
 void setTransportServerListener(TransportServerListener listener)
          Registers an TransportAcceptListener which is notified of accepted channels.
 void start()
           
 void start(Runnable onCompleted)
          Starts the service.
 void stop()
           
 void stop(Runnable onCompleted)
          Stops the service.
 void suspend()
          suspend accepting new transports
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TcpTransportServer

public TcpTransportServer(URI location)
                   throws UnknownHostException
Throws:
UnknownHostException
Method Detail

setTransportServerListener

public void setTransportServerListener(TransportServerListener listener)
Description copied from interface: TransportServer
Registers an TransportAcceptListener which is notified of accepted channels.

Specified by:
setTransportServerListener in interface TransportServer

getSocketAddress

public InetSocketAddress getSocketAddress()
Specified by:
getSocketAddress in interface TransportServer
Returns:
The socket address that this transport is accepting connections on or null if this does not or is not currently accepting connections on a socket.

getDispatchQueue

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

Specified by:
getDispatchQueue in interface TransportServer
Returns:

setDispatchQueue

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

Specified by:
setDispatchQueue in interface TransportServer

suspend

public void suspend()
Description copied from interface: TransportServer
suspend accepting new transports

Specified by:
suspend in interface TransportServer

resume

public void resume()
Description copied from interface: TransportServer
resume accepting new transports

Specified by:
resume in interface TransportServer

start

public void start()
           throws Exception
Throws:
Exception

start

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

Specified by:
start in interface TransportServer
Parameters:
onCompleted - my be set to null if not interested in a callback.
Throws:
Exception

getBoundAddress

public String getBoundAddress()
Specified by:
getBoundAddress in interface TransportServer

getConnectAddress

public String getConnectAddress()
Specified by:
getConnectAddress in interface TransportServer

resolveHostName

protected String resolveHostName()

stop

public void stop()
          throws Exception
Throws:
Exception

stop

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

Specified by:
stop in interface TransportServer
Parameters:
onCompleted - my be set to null if not interested in a callback.
Throws:
Exception

getBacklog

public int getBacklog()

setBacklog

public void setBacklog(int backlog)

handleSocket

protected final void handleSocket(SocketChannel socket)
                           throws Exception
Throws:
Exception

createTransport

protected TcpTransport createTransport()

toString

public String toString()
Overrides:
toString in class Object
Returns:
pretty print of this

getReceive_buffer_size

public int getReceive_buffer_size()

setReceive_buffer_size

public void setReceive_buffer_size(int receive_buffer_size)


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