com.caucho.amp.impl
Class QueueMailbox

java.lang.Object
  extended by com.caucho.amp.stream.AbstractAmpStream
      extended by com.caucho.amp.mailbox.AbstractAmpMailbox
          extended by com.caucho.amp.impl.QueueMailbox
All Implemented Interfaces:
AmpMailbox, AmpStream

public class QueueMailbox
extends AbstractAmpMailbox

Mailbox for an actor


Constructor Summary
QueueMailbox(AmpActorContext actor, java.util.concurrent.Executor executor)
           
 
Method Summary
 void close()
          Closes the mailbox
 void error(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
          Sends a message error to an ActorHolder, addressed by the Actor's address.
 AmpActorContext getActorContext()
           
 AmpStream getActorStream()
          Returns the delegated actor stream for the actor itself.
 void query(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
          Sends a query/RPCinformation call The receiver of a query acts as a service and the caller acts as a client.
 void queryError(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
          Sends a query error from a failed query.
 void queryResult(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.Object result)
          Sends a query response for a query
 void send(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
          Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueueMailbox

public QueueMailbox(AmpActorContext actor,
                    java.util.concurrent.Executor executor)
Method Detail

getActorStream

public AmpStream getActorStream()
Returns the delegated actor stream for the actor itself.


getActorContext

public AmpActorContext getActorContext()

send

public void send(AmpActorRef to,
                 AmpActorRef from,
                 AmpEncoder encoder,
                 java.lang.String methodName,
                 java.lang.Object... args)
Description copied from interface: AmpStream
Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.

Specified by:
send in interface AmpStream
Overrides:
send in class AbstractAmpStream
Parameters:
to - the target actor's address
from - the source actor's address

query

public void query(long id,
                  AmpActorRef to,
                  AmpActorRef from,
                  AmpEncoder encoder,
                  java.lang.String methodName,
                  java.lang.Object... args)
Description copied from interface: AmpStream
Sends a query/RPCinformation call The receiver of a query acts as a service and the caller acts as a client. Because BAM Actors are symmetrical, all Actors can act as services and clients for different RPC calls. The stream MUST send a queryResult or queryError to the client using the same id, because RPC clients rely on a response.

Specified by:
query in interface AmpStream
Overrides:
query in class AbstractAmpStream
Parameters:
id - the query identifier used to match requests with responses
to - the service actor's address
from - the client actor's address

queryResult

public void queryResult(long id,
                        AmpActorRef to,
                        AmpActorRef from,
                        AmpEncoder encoder,
                        java.lang.Object result)
Description copied from interface: AmpStream
Sends a query response for a query

Specified by:
queryResult in interface AmpStream
Overrides:
queryResult in class AbstractAmpStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address

queryError

public void queryError(long id,
                       AmpActorRef to,
                       AmpActorRef from,
                       AmpEncoder encoder,
                       AmpError error)
Description copied from interface: AmpStream
Sends a query error from a failed query.

Specified by:
queryError in interface AmpStream
Overrides:
queryError in class AbstractAmpStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
error - additional error information

error

public void error(AmpActorRef to,
                  AmpActorRef from,
                  AmpEncoder encoder,
                  AmpError error)
Description copied from interface: AmpStream
Sends a message error to an ActorHolder, addressed by the Actor's address. Actor protocols may choose to send error messages if a message fails for some reason. In general, Actors should not rely on the delivery of error messages. If an error return is required, use an RPC query instead.

Specified by:
error in interface AmpStream
Overrides:
error in class AbstractAmpStream
Parameters:
to - the target actor's address
from - the source actor's address
error - the message error

close

public void close()
Closes the mailbox

Specified by:
close in interface AmpMailbox
Overrides:
close in class AbstractAmpMailbox

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object