Up | Previous | Next |
Servers and clients will now have to be started separately, since they run on different machines.
import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.*; public class Server implements ServerInterface { public synchronized int register(ClientInterface client) throws RemoteException { size++; return size; } int size = -1; public static void main(String[] args) { } }
Since the sequential setup won't be available then we should make sure id's get distributed consistently.
So we serialize all concurrent access to the server's registration method (which distributes id's).
Up | Previous | Next |