OnJava8-Examples/remote/PerfectTimeServer.java

21 lines
679 B
Java
Raw Normal View History

2015-06-01 11:35:03 -07:00
//: remote/PerfectTimeServer.java
2015-06-02 11:55:14 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-06-01 11:35:03 -07:00
// Server for the PerfectTime remote object.
// {ValidateByHand}
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class PerfectTimeServer {
2015-06-02 11:55:14 -07:00
public static
void main(String[] args) throws RemoteException {
2015-06-01 11:35:03 -07:00
PerfectTimeImpl pt = new PerfectTimeImpl();
2015-06-02 11:55:14 -07:00
PerfectTime stub = (PerfectTime)
UnicastRemoteObject.exportObject(pt, 0);
2015-06-01 11:35:03 -07:00
Registry registry = LocateRegistry.getRegistry();
registry.rebind("PerfectTime", stub);
System.out.println("Ready to do time");
}
} ///:~