Guest User

Untitled

a guest
May 20th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. package client;
  2.  
  3. import java.rmi.registry.LocateRegistry;
  4. import java.rmi.registry.Registry;
  5. import java.math.BigDecimal;
  6. import compute.Compute;
  7.  
  8. public class ComputePi
  9. {
  10.     public static void main(String args[])
  11.     {
  12.         if (System.getSecurityManager() == null)
  13.         {
  14.             System.setSecurityManager(new SecurityManager());
  15.         }
  16.         try
  17.         {
  18.             String name = "Compute";
  19.             Registry registry = LocateRegistry.getRegistry(args[0]);
  20.             Compute comp = (Compute)registry.lookup(name);
  21.             Pi task = new Pi(Integer.parseInt(args[1]));
  22.             BigDecimal pi = comp.executeTask(task);
  23.             System.out.println(pi);
  24.         }
  25.         catch (Exception e)
  26.         {
  27.             System.err.println("ComputePi exception:");
  28.             e.printStackTrace();
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment