com.caucho.bam.mailbox
Class DualSizeMailbox

java.lang.Object
  extended by com.caucho.bam.mailbox.DualSizeMailbox
All Implemented Interfaces:
Mailbox, MessageStream

public class DualSizeMailbox
extends java.lang.Object
implements Mailbox

Mailbox which filters large messages to a separate queue, so large messages don't block small messages.


Constructor Summary
DualSizeMailbox(java.lang.String address, Broker broker, Mailbox smallMailbox, Mailbox largeMailbox)
           
 
Method Summary
 void close()
          Closes the mailbox
 MessageStream getActorStream()
          Returns the actor stream for the actor itself.
 java.lang.String getAddress()
          Returns the actor's address
 Broker getBroker()
          Returns the owning broker
 boolean isClosed()
          Tests if the stream is closed.
 void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a message
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a message
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Query an entity
 void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Query an entity
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Query an entity
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DualSizeMailbox

public DualSizeMailbox(java.lang.String address,
                       Broker broker,
                       Mailbox smallMailbox,
                       Mailbox largeMailbox)
Method Detail

getAddress

public java.lang.String getAddress()
Returns the actor's address

Specified by:
getAddress in interface MessageStream

getBroker

public Broker getBroker()
Description copied from interface: MessageStream
Returns the owning broker

Specified by:
getBroker in interface MessageStream

isClosed

public boolean isClosed()
Description copied from interface: MessageStream
Tests if the stream is closed.

Specified by:
isClosed in interface MessageStream

getActorStream

public MessageStream getActorStream()
Description copied from interface: Mailbox
Returns the actor stream for the actor itself.

Specified by:
getActorStream in interface Mailbox

message

public void message(java.lang.String to,
                    java.lang.String from,
                    java.io.Serializable payload)
Sends a message

Specified by:
message in interface MessageStream
Parameters:
to - the target actor's address
from - the source actor's address
payload - the message payload

messageError

public void messageError(java.lang.String to,
                         java.lang.String from,
                         java.io.Serializable payload,
                         BamError error)
Sends a message

Specified by:
messageError in interface MessageStream
Parameters:
to - the target actor's address
from - the source actor's address
payload - the message payload
error - the message error

query

public void query(long id,
                  java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable payload)
Query an entity

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

queryResult

public void queryResult(long id,
                        java.lang.String to,
                        java.lang.String from,
                        java.io.Serializable payload)
Query an entity

Specified by:
queryResult in interface MessageStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
payload - the result payload

queryError

public void queryError(long id,
                       java.lang.String to,
                       java.lang.String from,
                       java.io.Serializable payload,
                       BamError error)
Query an entity

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

close

public void close()
Description copied from interface: Mailbox
Closes the mailbox

Specified by:
close in interface Mailbox

toString

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