?? computeengine.java
字號(hào):
package engine;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import compute.Compute;
import compute.Task;
public class ComputeEngine extends UnicastRemoteObject implements compute.Compute {
public ComputeEngine() throws RemoteException {
super();
}
public <T> T executeTask(Task<T> t) {
return t.execute();
}
public static void main(String[] args) {
System.setProperty("java.security.policy", ".\\engine\\server.policy");
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
java.rmi.registry.LocateRegistry.createRegistry(3138);
} catch (Exception e) {
e.printStackTrace();
}
try {
String name = "//162.105.146.95:3138/Compute";
Compute engine = new ComputeEngine();
// Compute stub = (Compute) UnicastRemoteObject
// .exportObject(engine, 0);
// Registry registry = LocateRegistry.getRegistry();
// registry.rebind(name, stub);
Naming.rebind(name, engine);
System.out.println("ComputeEngine bound");
} catch (Exception e) {
System.err.println("ComputeEngine exception:");
e.printStackTrace();
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -