Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package client;
- import java.rmi.registry.LocateRegistry;
- import java.rmi.registry.Registry;
- import java.math.BigDecimal;
- import compute.Compute;
- public class ComputePi
- {
- public static void main(String args[])
- {
- if (System.getSecurityManager() == null)
- {
- System.setSecurityManager(new SecurityManager());
- }
- try
- {
- String name = "Compute";
- Registry registry = LocateRegistry.getRegistry(args[0]);
- Compute comp = (Compute)registry.lookup(name);
- Pi task = new Pi(Integer.parseInt(args[1]));
- BigDecimal pi = comp.executeTask(task);
- System.out.println(pi);
- }
- catch (Exception e)
- {
- System.err.println("ComputePi exception:");
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment