next up previous contents
Next: Migration Up: How SALSA Supports the Previous: Universal actor creation   Contents

Referencing actors

Actor references can be used as the target of message sending or arguments of messages. There are three ways to get actor references. Two of them, the return value of actor creation and references from message, are available in both distributed and concurrent SALSA programming. The last one, getReferenceByName(), is an explicit approach that translates a string or a UAN into a reference. In SALSA, only references of service actors should be obtained from this function. Otherwise, SALSA does not guarantee the safety property of actor garbage collection, which means one can get a phantom reference (a reference pointing to nothing). The way to get a reference by getReferenceByName() is shown as follows:
 
AddressBook remoteSVC= (AddressBook) 
  AddressBook.getReferenceByName("uan://nameserver1/id");
 
   
The other approach to get a reference by getReferenceByName() is to use ActorReference:
 
ActorReference remoteSVC=  ActorReference.getReferenceByName(
                           "uan://nameserver1/id");
 
   
Sometimes an actor wants to know who or where it is. An actor can get its UAL (where) by the function getUAL() and UAN (who) by getUAN().



Wei-Jen Wang 2005-10-24