OnJava8-Examples/remote/ptime/DisplayPerfectTime.java

27 lines
755 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: remote/ptime/DisplayPerfectTime.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-05-05 11:20:13 -07:00
// Uses remote object PerfectTime
// {RunByHand}
package remote.ptime;
2015-05-06 12:09:38 -07:00
import java.net.MalformedURLException;
2015-05-05 11:20:13 -07:00
import java.rmi.*;
import java.rmi.registry.*;
public class DisplayPerfectTime {
public static void main(String[] args) {
System.setSecurityManager(new SecurityManager());
try {
PerfectTimeI t =
(PerfectTimeI)Naming.lookup(
"//MindviewToshibaLaptop:2005/PerfectTime");
for(int i = 0; i < 10; i++)
System.out.println("Perfect time = " +
t.getPerfectTime());
2015-05-06 12:09:38 -07:00
} catch(NotBoundException |
MalformedURLException |
RemoteException e) {
2015-05-05 11:20:13 -07:00
e.printStackTrace();
}
}
} ///:~