Java Reference
In-Depth Information
13. public void execute(){
14. try{
15. ServerDataStore dataStore = (ServerDataStore)Naming.lookup(url);
16. address = dataStore.retrieveAddress(addressID);
17. }
18. catch (Exception exc){
19. }
20. }
21.
22. public Address getAddress(){ return address; }
23. public boolean isAddressAvailable(){ return (address == null) ? false : true; }
24. }
Example 4.14 ContractRetriever.java
1. import java.rmi.Naming;
2. import java.rmi.RemoteException;
3. public class ContactRetriever implements RunnableTask{
4. private Contact contact;
5. private long contactID;
6. private String url;
7.
8. public ContactRetriever(long newContactID, String newUrl){
9. contactID = newContactID;
10. url = newUrl;
11. }
12.
13. public void execute(){
14. try{
15. ServerDataStore dataStore = (ServerDataStore)Naming.lookup(url);
16. contact = dataStore.retrieveContact(contactID);
17. }
18. catch (Exception exc){
19. }
20. }
21.
22. public Contact getContact(){ return contact; }
23. public boolean isContactAvailable(){ return (contact == null) ? false : true; }
24. }
Search WWH ::




Custom Search