|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectakka.remote.transport.TestTransport
public class TestTransport
Transport implementation to be used for testing.
The TestTransport is basically a shared memory between actor systems. The TestTransport could be programmed to emulate different failure modes of a Transport implementation. TestTransport keeps a log of the activities it was requested to do. This class is not optimized for performace and MUST not be used as an in-memory transport in production systems.
Nested Class Summary | |
---|---|
static interface |
TestTransport.Activity
Base trait for activities that are logged by TestTransport . |
static class |
TestTransport.AssociateAttempt
|
static class |
TestTransport.AssociateAttempt$
|
static class |
TestTransport.AssociationRegistry
Shared state among TestTransport instances. |
static class |
TestTransport.DisassociateAttempt
|
static class |
TestTransport.DisassociateAttempt$
|
static class |
TestTransport.ListenAttempt
|
static class |
TestTransport.ListenAttempt$
|
static class |
TestTransport.ShutdownAttempt
|
static class |
TestTransport.ShutdownAttempt$
|
static class |
TestTransport.SwitchableLoggedBehavior<A,B>
Test utility to make behavior of functions that return some Future[B] controllable from tests. |
static class |
TestTransport.WriteAttempt
|
static class |
TestTransport.WriteAttempt$
|
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 | |
---|---|
TestTransport(Address localAddress,
TestTransport.AssociationRegistry registry,
int maximumPayloadBytes,
java.lang.String schemeIdentifier)
|
|
TestTransport(ExtendedActorSystem system,
com.typesafe.config.Config conf)
|
Method Summary | |
---|---|
scala.concurrent.Future<AssociationHandle> |
associate(Address remoteAddress)
Asynchronously opens a logical duplex link between two Transport Entities over a network. |
TestTransport.SwitchableLoggedBehavior<Address,AssociationHandle> |
associateBehavior()
The TestTransport.SwitchableLoggedBehavior for the associate() method. |
void |
disassociate(TestAssociationHandle handle)
|
TestTransport.SwitchableLoggedBehavior<TestAssociationHandle,scala.runtime.BoxedUnit> |
disassociateBehavior()
The TestTransport.SwitchableLoggedBehavior for the disassociate() method on handles. |
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. |
TestTransport.SwitchableLoggedBehavior<scala.runtime.BoxedUnit,scala.Tuple2<Address,scala.concurrent.Promise<Transport.AssociationEventListener>>> |
listenBehavior()
The TestTransport.SwitchableLoggedBehavior for the listen() method. |
Address |
localAddress()
|
int |
maximumPayloadBytes()
Defines the maximum size of payload this transport is able to deliver. |
TestTransport.AssociationRegistry |
registry()
|
java.lang.String |
schemeIdentifier()
Returns a string that will be used as the scheme part of the URLs corresponding to this transport |
scala.concurrent.Future<java.lang.Object> |
shutdown()
Shuts down the transport layer and releases all the corresponding resources. |
TestTransport.SwitchableLoggedBehavior<scala.runtime.BoxedUnit,java.lang.Object> |
shutdownBehavior()
The TestTransport.SwitchableLoggedBehavior for the shutdown() method. |
java.lang.String |
toString()
|
boolean |
write(TestAssociationHandle handle,
ByteString payload)
|
TestTransport.SwitchableLoggedBehavior<scala.Tuple2<TestAssociationHandle,ByteString>,java.lang.Object> |
writeBehavior()
The TestTransport.SwitchableLoggedBehavior for the write() method on handles. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface akka.remote.transport.Transport |
---|
managementCommand |
Constructor Detail |
---|
public TestTransport(Address localAddress, TestTransport.AssociationRegistry registry, int maximumPayloadBytes, java.lang.String schemeIdentifier)
public TestTransport(ExtendedActorSystem system, com.typesafe.config.Config conf)
Method Detail |
---|
public Address localAddress()
public final TestTransport.AssociationRegistry registry()
public int maximumPayloadBytes()
Transport
maximumPayloadBytes
in interface Transport
public java.lang.String schemeIdentifier()
Transport
schemeIdentifier
in interface Transport
public boolean isResponsibleFor(Address address)
Transport
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.
isResponsibleFor
in interface Transport
address
- (undocumented)
public TestTransport.SwitchableLoggedBehavior<scala.runtime.BoxedUnit,scala.Tuple2<Address,scala.concurrent.Promise<Transport.AssociationEventListener>>> listenBehavior()
TestTransport.SwitchableLoggedBehavior
for the listen() method.
public TestTransport.SwitchableLoggedBehavior<Address,AssociationHandle> associateBehavior()
TestTransport.SwitchableLoggedBehavior
for the associate() method.
public TestTransport.SwitchableLoggedBehavior<scala.runtime.BoxedUnit,java.lang.Object> shutdownBehavior()
TestTransport.SwitchableLoggedBehavior
for the shutdown() method.
public scala.concurrent.Future<scala.Tuple2<Address,scala.concurrent.Promise<Transport.AssociationEventListener>>> listen()
Transport
Transport.AssociationEventListener
, that
listener becomes responsible for handling incoming associations. Until the Promise is not completed, no associations
are processed.
listen
in interface Transport
public scala.concurrent.Future<AssociationHandle> associate(Address remoteAddress)
Transport
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.
associate
in interface Transport
remoteAddress
- The address of the remote transport entity.
AssociationHandle
public scala.concurrent.Future<java.lang.Object> shutdown()
Transport
The transport SHOULD try flushing pending writes before becoming completely closed.
shutdown
in interface Transport
public TestTransport.SwitchableLoggedBehavior<scala.Tuple2<TestAssociationHandle,ByteString>,java.lang.Object> writeBehavior()
TestTransport.SwitchableLoggedBehavior
for the write() method on handles. All
handle calls pass through this call. Please note, that write operations return a Boolean synchronously, so
altering the behavior via pushDelayed will turn write to a blocking operation -- use of pushDelayed therefore
is not recommended.
public TestTransport.SwitchableLoggedBehavior<TestAssociationHandle,scala.runtime.BoxedUnit> disassociateBehavior()
TestTransport.SwitchableLoggedBehavior
for the disassociate() method on handles. All
handle calls pass through this call.
public boolean write(TestAssociationHandle handle, ByteString payload)
public void disassociate(TestAssociationHandle handle)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |