|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.actor.AbstractReceiver
ptolemy.actor.Mailbox
ptolemy.actor.process.MailboxBoundaryReceiver
A process receiver that stores tokens via a mailbox and can be used by composite actors. This receiver extends the functionality of the mailbox receiver found in the actor package in two key ways. First it facilitates blocking reads and writes. If a read (a call to get()) is attempted when this mailbox is empty then the call will block until a token is placed in the mailbox. Similarly if a write (a call to put()) is attempted when this mailbox is full (has a token) then the call will block until the token is removed from the mailbox.
The second key feature of this mailbox receiver is that it can be used by opaque composite actors operating in process-oriented models of computation. Indeed the name "MailboxBoundaryReceiver" is used to indicate that this receiver can be contained on the boundary of an opaque composite actor. The get() and put() methods of mailbox boundary receiver can be invoked by a Branch object. In such cases any blocks that occur are registered with the calling branch. The branch will then serve as a proxy by communicating to the director through the branch controller.
Note that it is not necessary for a mailbox boundary receiver to be used in the ports of an opaque composite actor. It is perfectly fine for a mailbox boundary receiver to be used in the ports of an atomic actor. In such cases the get() and put() methods are called without the use of a branch object. If blocking reads or writes occur they are registered with the controlling director without the need for a branch or branch controller.
Branch,
BranchController
| Yellow (davisj) |
| Green (mudit) |
| Field Summary |
| Fields inherited from class ptolemy.actor.Mailbox |
_token |
| Constructor Summary | |
MailboxBoundaryReceiver()
Construct an empty MailboxBoundaryReceiver with no container. |
|
MailboxBoundaryReceiver(IOPort container)
Construct an empty MailboxBoundaryReceiver with the specified container. |
|
| Method Summary | |
Token |
get()
Get a token from this receiver. |
Token |
get(Branch branch)
Get a token from the receiver and use the specified branch object to manage the method invocation. |
boolean |
isConnectedToBoundary()
Return true if this receiver is connected to a boundary port. |
boolean |
isConnectedToBoundaryInside()
Return true if this receiver is connected to the inside of an input boundary port; return false otherwise. |
boolean |
isConnectedToBoundaryOutside()
Return true if this receiver is connected to the outside of an output boundary port; return false otherwise. |
boolean |
isConsumerReceiver()
Return true if this is a consumer receiver; return false otherwise. |
boolean |
isInsideBoundary()
Return true if this receiver is contained on the inside of a boundary port. |
boolean |
isOutsideBoundary()
Return true if this receiver is contained on the outside of a boundary port. |
boolean |
isProducerReceiver()
Return true if this is a producer receiver; return false otherwise. |
boolean |
isReadBlocked()
Return true if this receiver is read blocked; return false otherwise. |
boolean |
isWriteBlocked()
Return true if this receiver is write blocked; return false otherwise. |
void |
prepareToBlock(Branch branch)
Prepare to register a block. |
void |
put(Token token)
Put a token into this receiver. |
void |
put(Token token,
Branch branch)
Put a token in the receiver and use the specified branch object to manage the method invocation. |
void |
requestFinish()
Set a local flag requesting that execution of the actor containing this receiver discontinue. |
void |
reset()
Reset the local flags of this receiver. |
void |
wakeUpBlockedPartner()
Unblock this receiver and register this new state with either the monitoring branch or the local director. |
| Methods inherited from class ptolemy.actor.Mailbox |
clear, hasRoom, hasRoom, hasToken, hasToken |
| Methods inherited from class ptolemy.actor.AbstractReceiver |
getArray, getContainer, getCurrentTime, isKnown, putArray, setContainer |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ptolemy.actor.Receiver |
clear, getArray, getContainer, hasRoom, hasRoom, hasToken, hasToken, isKnown, putArray, setContainer |
| Constructor Detail |
public MailboxBoundaryReceiver()
public MailboxBoundaryReceiver(IOPort container)
throws IllegalActionException
IllegalActionException - If the container cannot contain
this receiver.| Method Detail |
public Token get()
get in interface Receiverget in class Mailboxpublic Token get(Branch branch)
get in interface ProcessReceiverbranch - The Branch managing execution of this method.
public boolean isConnectedToBoundary()
isConnectedToBoundary in interface ProcessReceiverBoundaryDetectorpublic boolean isConnectedToBoundaryInside()
isConnectedToBoundaryInside in interface ProcessReceiverBoundaryDetectorpublic boolean isConnectedToBoundaryOutside()
isConnectedToBoundaryOutside in interface ProcessReceiverBoundaryDetectorpublic boolean isConsumerReceiver()
isConsumerReceiver in interface ProcessReceiverpublic boolean isInsideBoundary()
isInsideBoundary in interface ProcessReceiverBoundaryDetectorpublic boolean isOutsideBoundary()
isOutsideBoundary in interface ProcessReceiverBoundaryDetectorpublic boolean isProducerReceiver()
isProducerReceiver in interface ProcessReceiverpublic boolean isReadBlocked()
isReadBlocked in interface ProcessReceiverpublic boolean isWriteBlocked()
isWriteBlocked in interface ProcessReceiverpublic void prepareToBlock(Branch branch)
branch - The Branch managing execution of this method.
public void put(Token token,
Branch branch)
put in interface ProcessReceiverbranch - The Branch managing execution of this method.token - The token to be placed in this receiver.public void put(Token token)
put in interface Receiverput in class Mailboxtoken - The token being placed in this receiver.public void requestFinish()
requestFinish in interface ProcessReceiverpublic void reset()
reset in interface ProcessReceiverpublic void wakeUpBlockedPartner()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||