computepi.java

来自「进行RMI调用的实际例子, 远程调用计算PI值的实例, 稍加改造可以实现实际用途」· Java 代码 · 共 21 行

JAVA
21
字号
import java.rmi.*;
import java.math.*;

public class computePI{
	public static void main(String [] args){
		if(System.getSecurityManager() == null){
			System.setSecurityManager(new RMISercurityManager());
		}
		
		try{
			String name = "//" + args[0] + "/compute";
			compute comp = (compute)Naming.lookup(name);
			
			PI task = new PI(Integer.parseInt(args[1]));
			BigDecimal pi = (BigDecimal)(comp.executeTask(task));
			System.out.println(pi);
		}catch(Exception e){
			System.err.println("ComputePI exception:" + e.getMessage());
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?