CS158a
Chris Pollett
May 2, 2011
Which of the following is true?
public interface Contract extends Remote {//Remote is in java.rmi public void method1(...) throws RemoteException; //other methods }
public class ServiceProvider extends UnicastRemoteObject implements Contract {/*code*/}
Contract server = new ServiceProvider(...); Naming.rebind(name, server);
rmic ServiceProviderThis generates two files ServiceProvider_stub.class and ServiceProvider_Skel.class. The former should be on the client machine the latter on the server. These class files actually handle the communication over the internet.
Remote remoteObj = Naming.lookup(name); /*looking up rmi names is done with a URL like rmi://host:port/name where name is the name of the service on the server */ Contract serverObj = (Contract)remoteObj; ... serverObj.method1(...);