Actor references can be used as the target of message sending expressions or as arguments of messages. There are three ways to get an actor reference. Two of them, the return value of actor creation and references from messages, are available in both distributed and concurrent SALSA programming. The last one, getReferenceByName(), is an explicit approach that translates a string representing a UAN into a reference. In SALSA, only references to service actors (see Section 4.2.4) should be obtained using 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 remoteService= (AddressBook) AddressBook.getReferenceByName("uan://nameserver1/id"); |
UAL selfUAL= this.getUAL(); UAN selfUAN = this.getUAN(); |