01 
02 /**
03  * The Echo interface
04 import java.rmi.*;
05 public interface Echo extends Remote {
06   public String echo(String strthrows RemoteException;
07
08 /**
09  * The Echo implementation
10  **/
11 import java.rmi.*;
12 import java.rmi.server.*;
13 import java.util.concurrent.*;
14 
15 public class EchoImpl extends UnicastRemoteObject implements Echo {
16   CyclicBarrier bar;
17   public EchoImpl() throws RemoteException {
18     super();
19     bar = new CyclicBarrier(2);
20   }
21 
22   public String echo(String strthrows RemoteException {
23     int ret=−1;
24     System.out.println("Recu: "+str);
25     try{
26       ret = bar.await();
27     }catch(Exception e){}
28     System.out.println("Renvoi: "+ret);
29     return String.valueOf(ret);
30 }
31
Java2html