package rmi;
import java.io.Serializable;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class ComputeServer
extends UnicastRemoteObject
implements Computable {
public ComputeServer() throws RemoteException {
}
public void println(Serializable o)
throws RemoteException {
System.out.println(o);
}
public static void main(String[] args)
throws RemoteException {
System.setSecurityManager(
new RMISecurityManager());
try {
lookUpServerAndBindWithRegistry();
} catch (Exception e) {
e.printStackTrace();
}
}
private static void lookUpServerAndBindWithRegistry() throws java.rmi.RemoteException, java.net.MalformedURLException {
ComputeServer cs =
new ComputeServer();
String url =
"rmi://localhost/ComputeServer";
java.rmi.Naming.rebind(url, cs);
System.out.println("server started");
}
}