public class MultiworkerMailbox extends java.lang.Object implements Mailbox, java.io.Closeable
Constructor and Description |
---|
MultiworkerMailbox(MessageStream actorStream,
Broker broker,
int threadMax) |
MultiworkerMailbox(java.lang.String address,
MessageStream actorStream,
Broker broker,
int threadMax) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the mailbox
|
protected ActorProcessor<Packet> |
createProcessor() |
protected MailboxQueue2 |
createWorker() |
protected void |
enqueue(Packet packet) |
MessageStream |
getActorStream()
Returns the actor stream for the actor itself.
|
java.lang.String |
getAddress()
Returns the actor's address
|
Broker |
getBroker()
Returns the stream back to the link for error packets
|
protected long |
getCurrentTimeActual() |
int |
getSize()
Returns the queue size
|
int |
getThreadMax() |
boolean |
isClosed()
Tests if the stream is closed.
|
boolean |
isPacketAvailable()
Returns true if a message is available.
|
void |
message(java.lang.String to,
java.lang.String from,
java.io.Serializable value)
Sends a message
|
void |
messageError(java.lang.String to,
java.lang.String from,
java.io.Serializable value,
BamError error)
Sends a message
|
void |
query(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable query)
Query an entity
|
void |
queryError(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable query,
BamError error)
Query an entity
|
void |
queryResult(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable value)
Query an entity
|
java.lang.String |
toString() |
public MultiworkerMailbox(MessageStream actorStream, Broker broker, int threadMax)
public MultiworkerMailbox(java.lang.String address, MessageStream actorStream, Broker broker, int threadMax)
protected MailboxQueue2 createWorker()
protected ActorProcessor<Packet> createProcessor()
public int getThreadMax()
public int getSize()
Mailbox
public java.lang.String getAddress()
getAddress
in interface MessageStream
public boolean isPacketAvailable()
public Broker getBroker()
getBroker
in interface MessageStream
public MessageStream getActorStream()
Mailbox
getActorStream
in interface Mailbox
public void message(java.lang.String to, java.lang.String from, java.io.Serializable value)
message
in interface MessageStream
to
- the target actor's addressfrom
- the source actor's addressvalue
- the message payloadpublic void messageError(java.lang.String to, java.lang.String from, java.io.Serializable value, BamError error)
messageError
in interface MessageStream
to
- the target actor's addressfrom
- the source actor's addressvalue
- the message payloaderror
- the message errorpublic void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable query)
query
in interface MessageStream
id
- the query identifier used to match requests with responsesto
- the service actor's addressfrom
- the client actor's addressquery
- the query payloadpublic void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable value)
queryResult
in interface MessageStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addressvalue
- the result payloadpublic void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable query, BamError error)
queryError
in interface MessageStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addressquery
- the query payloaderror
- additional error informationprotected final void enqueue(Packet packet)
public void close()
Mailbox
protected long getCurrentTimeActual()
public boolean isClosed()
MessageStream
isClosed
in interface MessageStream
public java.lang.String toString()
toString
in class java.lang.Object