Exemple #1
0
  public JParSolverImpl(String host, int port) throws RemoteException {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
    }

    String serverName = "JParServer";
    try {
      Registry registry = LocateRegistry.getRegistry(host, port);
      this.server = (JParServer) registry.lookup(serverName);
    } catch (AccessException e) {
      System.err.println("Solver: Java RMI AccessException: " + e.getMessage());
      return;
    } catch (RemoteException e) {
      System.err.println("Solver: Java RMI Exception: " + e.getMessage());
      return;
    } catch (NotBoundException e) {
      System.err.println("Solver: " + serverName + " lookup failed:" + e.getMessage());
      return;
    } catch (Exception e) {
      System.err.println("Solver: JParSolver Constructor:" + e.getMessage());
      e.printStackTrace();
      return;
    }

    this.taskSynchObj = new Object();
    this.pendingJob = JOB_WAITING_FOR;

    if (this.register()) {
      initialized = true;
    }
  }
Exemple #2
0
 @Override
 public void setRemote(Object id, String ownerIP, int ownerPort) {
   $HY$_id = id;
   try {
     $HY$_proxy =
         (($HY$_IReservation)
             LocateRegistry.getRegistry(ownerIP, ownerPort).lookup(getClass().getName()));
   } catch (AccessException e) {
     e.printStackTrace();
   } catch (RemoteException e) {
     e.printStackTrace();
   } catch (NotBoundException e) {
     e.printStackTrace();
   } catch (Exception e) {
     try {
       Logger.debug(Arrays.toString(LocateRegistry.getRegistry(ownerIP, ownerPort).list()));
     } catch (AccessException e1) {
       e1.printStackTrace();
     } catch (RemoteException e1) {
       e1.printStackTrace();
     }
   }
 }