/Users/lyon/j4p/src/net/rmi/armi/ArmiHelloWorld.java

1    package net.rmi.armi; 
2    import java.util.*; 
3    import java.rmi.*; 
4    public class ArmiHelloWorld 
5            extends Observable { 
6        RmiHelloClient rmiHwClient  
7                = new RmiHelloClient( 
8                "rmi://localhost/RemoteHello"); 
9     
10       public ArmiHelloWorld() { 
11       } 
12    
13       public void getMsg() { 
14           Thread t = new Thread(new Runnable() { 
15               public void run() { 
16                   Object o = null; 
17                   try { 
18                       o = rmiHwClient.getMsg(); 
19                   } catch (RemoteException e) { 
20                       e.printStackTrace(); 
21                   } 
22                   setChanged(); 
23                   notifyObservers(o); 
24               } 
25           }); 
26           t.start(); 
27       } 
28    
29       public void testGetMsg() { 
30           Thread t = new Thread(new Runnable() { 
31               public void run() { 
32                   try { 
33                       rmiHwClient.testGetMsg(); 
34                   } catch (RemoteException e) { 
35                       e.printStackTrace(); 
36                   } 
37               } 
38           }); 
39           t.start(); 
40       } 
41    
42   } 
43