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"); |
ActorReference remoteSVC= ActorReference.getReferenceByName( "uan://nameserver1/id"); |