?? rmi_client.java
字號:
package com;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class RMI_Client {
public void rmiclient(){
try {
Registry registry = LocateRegistry.getRegistry("127.0.0.1",1099);
// TestInterfactRemote testInterfactRemote = (TestInterfactRemote)registry.lookup("RMI");
/* System.out.println(testInterfactRemote.add("rmi a ", "rmib")); */
// I_Hello i_Hello = (I_Hello)registry.lookup("aaron"); //
I_Hello i_Hello = (I_Hello)registry.lookup("rmi://127.0.0.1:1099/aaron");
System.out.println(i_Hello.SayHello("tom"));
} catch (Exception e) {
e.printStackTrace();
}
}
public void f(){
Calendar cal = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss G E D F w W a E F");
String mDateTime=formatter.format(cal.getTime());
System.out.println("begin time: " + mDateTime);
int i;
for(i=0; i<100; i++){
rmiclient();
}
System.out.println("i="+i+"; t()榪愯
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -