com.sun.sgs.impl.transport.tcp
Class TcpTransport

java.lang.Object
  extended by com.sun.sgs.impl.transport.tcp.TcpTransport
All Implemented Interfaces:
Transport

public class TcpTransport
extends Object
implements Transport

Implementation of a TCP Transport. The constructor supports the following properties:

Property: "com.sun.sgs.impl.transport.tcp.listen.address"
Default: Listen on all network interfaces
Specifies the network address the transport will listen on.

Property: "com.sun.sgs.impl.transport.tcp.listen.port"
Default: 62964
Specifies the network port that the transport instance will listen on. The value must be between 1 and 65535.

Property: "com.sun.sgs.impl.transport.tcp.acceptor.backlog"
Default: 0
Specifies the acceptor backlog. This value is passed as the second argument to the AsynchronousServerSocketChannel.bind method.


Field Summary
(package private)  IoFuture<?,?> acceptFuture
          The currently-active accept operation, or null if none.
(package private)  AsynchronousServerSocketChannel acceptor
          The acceptor for listening for new connections.
static String ACCEPTOR_BACKLOG_PROPERTY
          The name of the acceptor backlog property.
static int DEFAULT_PORT
          The default port: 62964.
static String LISTEN_HOST_PROPERTY
          The server listen address property.
static String LISTEN_PORT_PROPERTY
          The name of the server port property.
(package private)  InetSocketAddress listenAddress
          The listen address.
 
Constructor Summary
TcpTransport(Properties properties)
          Constructs an instance of this class with the specified properties.
 
Method Summary
 void accept(ConnectionHandler handler)
          Start accepting connections.
 Delivery getDelivery()
          Returns the delivery guarantee for the transport.
 TransportDescriptor getDescriptor()
          Returns the descriptor for this transport.
 void shutdown()
          Shutdown the transport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LISTEN_HOST_PROPERTY

public static final String LISTEN_HOST_PROPERTY
The server listen address property. This is the host interface we are listening on. Default is listen on all interfaces.

See Also:
Constant Field Values

LISTEN_PORT_PROPERTY

public static final String LISTEN_PORT_PROPERTY
The name of the server port property.

See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port: 62964.

See Also:
Constant Field Values

listenAddress

final InetSocketAddress listenAddress
The listen address.


ACCEPTOR_BACKLOG_PROPERTY

public static final String ACCEPTOR_BACKLOG_PROPERTY
The name of the acceptor backlog property.

See Also:
Constant Field Values

acceptor

volatile AsynchronousServerSocketChannel acceptor
The acceptor for listening for new connections.


acceptFuture

volatile IoFuture<?,?> acceptFuture
The currently-active accept operation, or null if none.

Constructor Detail

TcpTransport

public TcpTransport(Properties properties)
Constructs an instance of this class with the specified properties.

Parameters:
properties - transport properties
Method Detail

getDescriptor

public TransportDescriptor getDescriptor()
Returns the descriptor for this transport. Multiple calls to this method may return the same object.

Specified by:
getDescriptor in interface Transport
Returns:
the descriptor for this transport

getDelivery

public Delivery getDelivery()
Returns the delivery guarantee for the transport.

Specified by:
getDelivery in interface Transport
Returns:
the delivery guarantee for the transport

accept

public void accept(ConnectionHandler handler)
Start accepting connections. The transport will invoke the specified handler's newConnection method when a connection is received. Once accept has been called, subsequent invocations will throw an IllegalStateException. If Transport.shutdown() has been called this method will throw an IllegalStateException.

Specified by:
accept in interface Transport
Parameters:
handler - the connection handler

shutdown

public void shutdown()
Shutdown the transport. The actions of this method are implementation dependent, but typically involve closing open network connections, releasing system resources, etc.. All shutdown activity is synchronous with this call. Once this method is called, subsequent calls to shutdown will have no affect.

Specified by:
shutdown in interface Transport

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved