akka.remote.transport.netty
Class NettyTransport

java.lang.Object
  extended by akka.remote.transport.netty.NettyTransport
All Implemented Interfaces:
Transport

public class NettyTransport
extends java.lang.Object
implements Transport


Nested Class Summary
 
Nested classes/interfaces inherited from interface akka.remote.transport.Transport
Transport.ActorAssociationEventListener, Transport.ActorAssociationEventListener$, Transport.AssociationEvent, Transport.AssociationEventListener, Transport.InboundAssociation, Transport.InboundAssociation$, Transport.InvalidAssociationException, Transport.InvalidAssociationException$
 
Constructor Summary
NettyTransport(ExtendedActorSystem system, com.typesafe.config.Config conf)
           
NettyTransport(NettyTransportSettings settings, ExtendedActorSystem system)
           
 
Method Summary
static scala.Option<Address> addressFromSocketAddress(java.net.SocketAddress addr, java.lang.String schemeIdentifier, java.lang.String systemName, scala.Option<java.lang.String> hostName)
           
 scala.concurrent.Future<java.net.InetSocketAddress> addressToSocketAddress(Address addr)
           
 scala.concurrent.Future<AssociationHandle> associate(Address remoteAddress)
          Asynchronously opens a logical duplex link between two Transport Entities over a network.
 org.jboss.netty.channel.group.DefaultChannelGroup channelGroup()
           
 scala.concurrent.ExecutionContext executionContext()
           
static int FrameLengthFieldLength()
           
static void gracefulClose(org.jboss.netty.channel.Channel channel, scala.concurrent.ExecutionContext ec)
           
 boolean isResponsibleFor(Address address)
          A function that decides whether the specific transport instance is responsible for delivering to a given address.
 scala.concurrent.Future<scala.Tuple2<Address,scala.concurrent.Promise<Transport.AssociationEventListener>>> listen()
          Asynchronously attempts to setup the transport layer to listen and accept incoming associations.
 int maximumPayloadBytes()
          Defines the maximum size of payload this transport is able to deliver.
 java.lang.String schemeIdentifier()
          Returns a string that will be used as the scheme part of the URLs corresponding to this transport
 NettyTransportSettings settings()
           
 scala.concurrent.Future<java.lang.Object> shutdown()
          Shuts down the transport layer and releases all the corresponding resources.
 ExtendedActorSystem system()
           
 java.util.concurrent.ConcurrentHashMap<java.net.SocketAddress,AssociationHandle.HandleEventListener> udpConnectionTable()
          INTERNAL API
static java.util.concurrent.atomic.AtomicInteger uniqueIdCounter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.remote.transport.Transport
managementCommand
 

Constructor Detail

NettyTransport

public NettyTransport(NettyTransportSettings settings,
                      ExtendedActorSystem system)

NettyTransport

public NettyTransport(ExtendedActorSystem system,
                      com.typesafe.config.Config conf)
Method Detail

FrameLengthFieldLength

public static int FrameLengthFieldLength()

gracefulClose

public static void gracefulClose(org.jboss.netty.channel.Channel channel,
                                 scala.concurrent.ExecutionContext ec)

uniqueIdCounter

public static java.util.concurrent.atomic.AtomicInteger uniqueIdCounter()

addressFromSocketAddress

public static scala.Option<Address> addressFromSocketAddress(java.net.SocketAddress addr,
                                                             java.lang.String schemeIdentifier,
                                                             java.lang.String systemName,
                                                             scala.Option<java.lang.String> hostName)

settings

public NettyTransportSettings settings()

system

public ExtendedActorSystem system()

executionContext

public scala.concurrent.ExecutionContext executionContext()

schemeIdentifier

public java.lang.String schemeIdentifier()
Description copied from interface: Transport
Returns a string that will be used as the scheme part of the URLs corresponding to this transport

Specified by:
schemeIdentifier in interface Transport
Returns:
the scheme string

maximumPayloadBytes

public int maximumPayloadBytes()
Description copied from interface: Transport
Defines the maximum size of payload this transport is able to deliver. All transports MUST support at least 32kBytes (32000 octets) of payload, but some MAY support larger sizes.

Specified by:
maximumPayloadBytes in interface Transport
Returns:

udpConnectionTable

public final java.util.concurrent.ConcurrentHashMap<java.net.SocketAddress,AssociationHandle.HandleEventListener> udpConnectionTable()
INTERNAL API


channelGroup

public org.jboss.netty.channel.group.DefaultChannelGroup channelGroup()

isResponsibleFor

public boolean isResponsibleFor(Address address)
Description copied from interface: Transport
A function that decides whether the specific transport instance is responsible for delivering to a given address. The function must be thread-safe and non-blocking.

The purpose of this function is to resolve cases when the scheme part of an URL is not enough to resolve the correct transport i.e. multiple instances of the same transport implementation are loaded. These cases arise when - the same transport, but with different configurations is used for different remote systems - a transport is able to serve one address only (hardware protocols, e.g. Serial port) and multiple instances are needed to be loaded for different endpoints.

Specified by:
isResponsibleFor in interface Transport
Returns:
whether the transport instance is responsible to serve communications to the given address.

addressToSocketAddress

public scala.concurrent.Future<java.net.InetSocketAddress> addressToSocketAddress(Address addr)

listen

public scala.concurrent.Future<scala.Tuple2<Address,scala.concurrent.Promise<Transport.AssociationEventListener>>> listen()
Description copied from interface: Transport
Asynchronously attempts to setup the transport layer to listen and accept incoming associations. The result of the attempt is wrapped by a Future returned by this method. The pair contained in the future contains a Promise for an ActorRef. By completing this Promise with an Transport.AssociationEventListener, that listener becomes responsible for handling incoming associations. Until the Promise is not completed, no associations are processed.

Specified by:
listen in interface Transport
Returns:
A Future containing a pair of the bound local address and a Promise of an AssociationListener that must be completed by the consumer of the future.

associate

public scala.concurrent.Future<AssociationHandle> associate(Address remoteAddress)
Description copied from interface: Transport
Asynchronously opens a logical duplex link between two Transport Entities over a network. It could be backed by a real transport-layer connection (TCP), more lightweight connections provided over datagram protocols (UDP with additional services), substreams of multiplexed connections (SCTP) or physical links (serial port).

This call returns a future of an AssociationHandle. A failed future indicates that the association attempt was unsuccessful. If the exception is Transport.InvalidAssociationException then the association request was invalid, and it is impossible to recover.

Specified by:
associate in interface Transport
Parameters:
remoteAddress - The address of the remote transport entity.
Returns:
A status instance representing failure or a success containing an AssociationHandle

shutdown

public scala.concurrent.Future<java.lang.Object> shutdown()
Description copied from interface: Transport
Shuts down the transport layer and releases all the corresponding resources. Shutdown is asynchronous signalling the end of the shutdown by completing the returned future.

The transport SHOULD try flushing pending writes before becoming completely closed.

Specified by:
shutdown in interface Transport
Returns:
Future signalling the completion of shutdown