Пример #1
1
 public void stopServer() {
   try {
     registry.unbind(SERVICE_NAME);
     UnicastRemoteObject.unexportObject(registry, true);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #2
0
  @Override
  protected MavenRemoteServer create() throws RemoteException {
    MavenRemoteServer server;
    try {
      server = client.acquire(this, "");
    } catch (Exception e) {
      throw new RemoteException("Can't start maven server", e);
    }
    if (!loggerExported) {
      Remote loggerRemote = UnicastRemoteObject.exportObject(rmiLogger, 0);
      if (!(loggerExported = loggerRemote != null)) {
        throw new RemoteException("Can't export logger");
      }
    }
    if (!listenerExported) {
      Remote listenerRemote = UnicastRemoteObject.exportObject(rmiDownloadListener, 0);
      if (!(listenerExported = listenerRemote != null)) {
        throw new RemoteException("Can't export download listener");
      }
    }

    server.configure(rmiLogger, rmiDownloadListener);

    return server;
  }
  public static void main(String[] args) throws Exception {

    System.err.println("\nRegression test for bug 4513223\n");

    Remote impl2 = null;
    try {
      Remote impl = new MarshalAfterUnexport2();
      System.err.println("created impl extending URO (with a UnicastServerRef2): " + impl);

      Receiver stub = (Receiver) RemoteObject.toStub(impl);
      System.err.println("stub for impl: " + stub);

      UnicastRemoteObject.unexportObject(impl, true);
      System.err.println("unexported impl");

      impl2 = new MarshalAfterUnexport2();
      Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);

      System.err.println("marshalling unexported object:");
      MarshalledObject mobj = new MarshalledObject(impl);

      System.err.println("passing unexported object via RMI-JRMP:");
      stub2.receive(stub);

      System.err.println("TEST PASSED");
    } finally {
      if (impl2 != null) {
        try {
          UnicastRemoteObject.unexportObject(impl2, true);
        } catch (Throwable t) {
        }
      }
    }
  }
Пример #4
0
  /** Stop. */
  public void stop() {
    this.lookupTask.stop();

    if (this.stub != null) {
      try {
        this.reg.unbind(this.bindingName);

        this.dist.unexportClients();

        this.dist.unexportServer();

        UnicastRemoteObject.unexportObject(this.dist, true);
      } catch (RemoteException rex) {
        logger.warning(rex.getMessage());
      } catch (NotBoundException nbex) {
        logger.warning(nbex.getMessage());
      }
    }

    try {
      UnicastRemoteObject.unexportObject(this.reg, true);
    } catch (NoSuchObjectException ex) {
      ex.printStackTrace();
    }
  }
Пример #5
0
  /* ------------------------------------------------------------------------------------------------------
   * Main Method for the application
   * ------------------------------------------------------------------------------------------------------
   */
  public static void main(String[] args) {
    // Check of the security manager is installed, if not se it.
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new SecurityManager());
    }
    try {
      // Locate the RMI registry
      Registry registry = LocateRegistry.getRegistry();

      // Create the Player object ref in the registry and bind it
      Players players = new Players();
      PlayerInterface stubPlayer =
          (PlayerInterface) UnicastRemoteObject.exportObject(players, 3001);
      Naming.rebind("rmi://localhost/Players", players);

      // Similar process for shapes.
      Shapes Hello = new Shapes();
      ShapeInterface stub = (ShapeInterface) UnicastRemoteObject.exportObject(Hello, 3001);
      Naming.rebind("rmi://localhost/Shapes", Hello);

      // Confirm to the console the server is ready
      System.out.println("2Draw Server is ready.");
    } catch (Exception e) {
      System.out.println("2Draw Server failed: " + e);
      e.printStackTrace();
    }
  }
Пример #6
0
 public void shutdown() {
   try {
     if (UnicastRemoteObject.unexportObject(this, false)) return;
     Thread.sleep(5000);
     UnicastRemoteObject.unexportObject(this, true);
   } catch (Exception e) {
     // nothing to do .. we're shutting down ...
   }
 }
  public static void main(String[] args) throws Exception {
    System.err.println("\nRegression test for bug 6261402\n");
    System.setProperty(
        "java.rmi.activation.port",
        Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
    RMID rmid = null;
    Callback obj = null;
    try {
      /*
       * Export callback object and bind in registry.
       */
      System.err.println("export callback object and bind in registry");
      obj = new CallbackImpl();
      Callback proxy = (Callback) UnicastRemoteObject.exportObject(obj, 0);
      Registry registry =
          LocateRegistry.createRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
      registry.bind("Callback", proxy);

      /*
       * Start rmid.
       */
      System.err.println("start rmid with inherited channel");
      RMID.removeLog();
      rmid =
          RMID.createRMID(
              System.out,
              System.err,
              true,
              true,
              TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
      rmid.addOptions(
          new String[] {
            "-Djava.nio.channels.spi.SelectorProvider=" + "InheritedChannelNotServerSocket$SP"
          });
      rmid.start();

      /*
       * Get activation system and wait to be notified via callback
       * from rmid's selector provider.
       */
      System.err.println("get activation system");
      ActivationSystem system = ActivationGroup.getSystem();
      System.err.println("ActivationSystem = " + system);
      synchronized (lock) {
        while (!notified) {
          lock.wait();
        }
      }
      System.err.println("TEST PASSED");
    } finally {
      if (obj != null) {
        UnicastRemoteObject.unexportObject(obj, true);
      }
      ActivationLibrary.rmidCleanup(rmid);
    }
  }
Пример #8
0
  public void deploy(URL url, boolean master, ClassLoader cL, String remoteHost) {
    try {
      FileObject filetoScan = fsManager.resolveFile("jar:" + url.toString() + "!/");
      HashSet<Class<?>>[] classes = new HashSet[] {new HashSet()};

      VFSClassLoader jarCL;

      if (cL != null) {
        jarCL = new VFSClassLoader(new FileObject[] {filetoScan}, fsManager, cL);
      } else {
        jarCL =
            new VFSClassLoader(
                new FileObject[] {filetoScan},
                fsManager,
                Thread.currentThread().getContextClassLoader());
      }
      Class[] annot = new Class[] {DeployRMI.class};
      scanJar(filetoScan, classes, annot, jarCL);
      for (Class<?> rmiClass : classes[0]) {
        DeployRMI rmiAnnot = rmiClass.getAnnotation(DeployRMI.class);
        if (master) {
          rmiProxyHandler = new RMIProxyHandler(rmiAnnot.jndiBinding(), remoteObjects);
          rmiproxy =
              Proxy.newProxyInstance(
                  rmiClass.getClassLoader(), rmiClass.getInterfaces(), rmiProxyHandler);
          remoteobj =
              UnicastRemoteObject.exportObject(
                  (Remote) rmiproxy, Integer.parseInt(serverConfig.getRmiregistryport()));
          rmiproxyObjs.put(rmiAnnot.jndiBinding(), rmiproxy);
          rmiproxyHandler.put(rmiAnnot.jndiBinding(), rmiProxyHandler);
          remoteProxyObjs.put(rmiAnnot.jndiBinding(), remoteobj);
          ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj);
          registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj);
          cLMap.put(rmiAnnot.jndiBinding(), jarCL);
        } else {
          Remote remoteObj = (Remote) rmiClass.newInstance();
          remoteSlaveObjs.put(rmiAnnot.jndiBinding(), remoteObj);
          Object remoteobj =
              UnicastRemoteObject.exportObject(
                  (Remote) remoteObj, Integer.parseInt(serverConfig.getRmiregistryport()));
          ic.bind("java:/" + rmiAnnot.jndiBinding(), remoteobj);
          registry.bind(rmiAnnot.jndiBinding(), (Remote) remoteobj);
          if (remoteObjects.get(rmiAnnot.jndiBinding()) != null) {
            ConcurrentMap<String, Remote> remoteObjs = remoteObjects.get(rmiAnnot.jndiBinding());
            remoteObjs.put(remoteHost, (Remote) remoteobj);
          } else {
            ConcurrentHashMap<String, Remote> remoteObjs = new ConcurrentHashMap<String, Remote>();
            remoteObjs.put(remoteHost, (Remote) remoteobj);
            remoteObjects.put(rmiAnnot.jndiBinding(), remoteObjs);
          }
        }
      }
    } catch (Exception e) {
      log.error("unable to deploy the package " + url, e);
    }
  }
Пример #9
0
  public static void main(String[] args) throws Exception {

    System.err.println("\nRegression test for RFE 4010355\n");

    ServerStackTrace impl = new ServerStackTrace();

    try {
      Ping stub = (Ping) UnicastRemoteObject.exportObject(impl);

      StackTraceElement[] remoteTrace;
      try {
        __FOO__(stub);
        throw new RuntimeException("TEST FAILED: no exception caught");
      } catch (PingException e) {
        System.err.println("trace of exception thrown by remote call:");
        e.printStackTrace();
        System.err.println();
        remoteTrace = e.getStackTrace();
      }

      int fooIndex = -1;
      int barIndex = -1;
      for (int i = 0; i < remoteTrace.length; i++) {
        StackTraceElement e = remoteTrace[i];
        if (e.getMethodName().equals("__FOO__")) {
          if (fooIndex != -1) {
            throw new RuntimeException("TEST FAILED: " + "trace contains more than one __FOO__");
          }
          fooIndex = i;
        } else if (e.getMethodName().equals("__BAR__")) {
          if (barIndex != -1) {
            throw new RuntimeException("TEST FAILED: " + "trace contains more than one __BAR__");
          }
          barIndex = i;
        }
      }
      if (fooIndex == -1) {
        throw new RuntimeException("TEST FAILED: trace lacks client-side method __FOO__");
      }
      if (barIndex == -1) {
        throw new RuntimeException("TEST FAILED: trace lacks server-side method __BAR__");
      }
      if (fooIndex < barIndex) {
        throw new RuntimeException(
            "TEST FAILED: trace contains client-side method __FOO__ "
                + "before server-side method __BAR__");
      }
      System.err.println("TEST PASSED");
    } finally {
      try {
        UnicastRemoteObject.unexportObject(impl, true);
      } catch (Exception e) {
      }
    }
  }
Пример #10
0
  /**
   * Exports the referenced Remote interface-implementing object for remote access through RMI.
   * Returns true on success, or false if the underlying exportObject() call threw a
   * RemoteException.
   */
  public boolean publishObject(Remote obj) {
    try {
      if (useSSL) {
        UnicastRemoteObject.exportObject(obj, this.port, this.csf, this.ssf);
      } else {
        UnicastRemoteObject.exportObject(obj, this.port);
      }

      return true;
    } catch (RemoteException ex) {
      return false;
    }
  }
Пример #11
0
 /**
  * Removes the Remote obj reference from remote accessiblity. Once this call returns, the obj will
  * not receive any more remote RMI calls. If force is true, the object will be unpublished even if
  * there are pending calls on it.
  *
  * <p>Returns true on successful unpublish, or false if there was some problem.
  */
 public boolean unpublishObject(Remote obj, boolean force) {
   try {
     return UnicastRemoteObject.unexportObject(obj, force);
   } catch (NoSuchObjectException ex) {
     return false;
   }
 }
Пример #12
0
  /**
   * Start.
   *
   * @return true, if successful
   */
  public boolean start() {
    reg = null;

    // Create or connect to the registry
    try {
      reg = this.regInfo.connect(this.initRegistry);
      this.dist = new Distributor(this);
      this.stub = (IDistributor) UnicastRemoteObject.exportObject(dist, 0);
      reg.bind(this.bindingName, this.stub);

    } catch (RemoteException rex) {
      logger.severe("Remote error: " + rex.getMessage());
      return false;
    } catch (AlreadyBoundException abex) {
      logger.severe(
          "The binding name \""
              + this.bindingName
              + "\" is already in use. Maybe this server is already started?");
      return false;
    }

    logger.info("\"" + this.bindingName + "\" started up");

    this.lookupTask.start();

    return true;
  }
Пример #13
0
  @AdviseWith(adviceClasses = {PropsUtilAdvice.class})
  @Test
  public void testClassInitializationOnSPI() throws Exception {
    System.setProperty(PropsKeys.INTRABAND_IMPL, SelectorIntraband.class.getName());
    System.setProperty(PropsKeys.INTRABAND_TIMEOUT_DEFAULT, "10000");
    System.setProperty(PropsKeys.INTRABAND_WELDER_IMPL, SocketWelder.class.getName());

    MPI mpiImpl = _getMPIImpl();

    Assert.assertNotNull(mpiImpl);
    Assert.assertTrue(mpiImpl.isAlive());

    MPI mpi = MPIHelperUtil.getMPI();

    Assert.assertSame(mpi, UnicastRemoteObject.toStub(mpiImpl));
    Assert.assertTrue(mpi.isAlive());

    Intraband intraband = MPIHelperUtil.getIntraband();

    Assert.assertSame(SelectorIntraband.class, intraband.getClass());

    DatagramReceiveHandler[] datagramReceiveHandlers = intraband.getDatagramReceiveHandlers();

    Assert.assertSame(
        BootstrapRPCDatagramReceiveHandler.class,
        datagramReceiveHandlers[SystemDataType.RPC.getValue()].getClass());
  }
  /** Instanciação e Inicialização do ZonaDesembarqueRegister */
  public ZonaDesembarqueRegister() {
    super();
    canEnd = false;

    try {
      registry = LocateRegistry.getRegistry(registryHostname, registryPort);
      log = (LoggingInterface) registry.lookup("Logging");
    } catch (RemoteException e) {
      GenericIO.writelnString("Excepção na localização do Logging: " + e.getMessage() + "!");
      e.printStackTrace();
      System.exit(1);
    } catch (NotBoundException e) {
      GenericIO.writelnString("O Logging não está registado: " + e.getMessage() + "!");
      e.printStackTrace();
      System.exit(1);
    }

    desembarque = new ZonaDesembarque(log, this);
    try {
      desembarqueInterface =
          (ZonaDesembarqueInterface)
              UnicastRemoteObject.exportObject(
                  desembarque, portNumber[Globals.MON_ZONA_DESEMBARQUE]);
    } catch (RemoteException e) {
      System.exit(1);
    }
  }
Пример #15
0
  @AdviseWith(adviceClasses = {PropsUtilAdvice.class})
  @Test
  public void testShutdownFailWithoutLog() throws NoSuchObjectException {
    UnicastRemoteObject.unexportObject(_getMPIImpl(), true);

    final IOException ioException = new IOException();

    ReflectionTestUtil.setFieldValue(
        MPIHelperUtil.class,
        "_intraband",
        new MockIntraband() {

          @Override
          public void close() throws IOException {
            throw ioException;
          }
        });

    try (CaptureHandler captureHandler =
        JDKLoggerTestUtil.configureJDKLogger(MPIHelperUtil.class.getName(), Level.OFF)) {

      MPIHelperUtil.shutdown();

      List<LogRecord> logRecords = captureHandler.getLogRecords();

      Assert.assertTrue(logRecords.isEmpty());
    }
  }
Пример #16
0
  public static void main(String args[]) {
    AnnuaireIF annuaire = new Annuaire();
    try {
      UnicastRemoteObject.exportObject(annuaire, 0);
    } catch (RemoteException e) {
      System.out.println("Lancé de nain lors de l'export de l'objet !");
      e.printStackTrace();
      System.exit(0);
    }

    Registry registry = null;
    try {
      registry = LocateRegistry.createRegistry(5500);
      // registry = LocateRegistry.getRegistry("localhost", 5500);
    } catch (RemoteException e) {
      System.out.println("Lancé de nain lors de la localisation de registry !");
      e.printStackTrace();
      System.exit(0);
    }
    try {
      registry.bind("Annuaire", annuaire);
    } catch (RemoteException | AlreadyBoundException e) {
      System.out.println("Lancé de nain lors du bind !");
      e.printStackTrace();
      System.exit(0);
    }

    System.out.println("Serveur lancé sans lancé de nain !");
  } // fin du main
Пример #17
0
  public static void main(String args[]) {
    // Figure out where server is running
    String server = "localhost";

    try {
      // create a new Server object
      FlightRM obj = new FlightRM();
      // dynamically generate the stub (client proxy)
      ResourceManager rm = (ResourceManager) UnicastRemoteObject.exportObject(obj, 0);

      // Bind the remote object's stub in the registry
      Registry registry = LocateRegistry.getRegistry(8778);
      registry.rebind("Group4FlightRM", rm);

      System.err.println("Flight Server ready");
    } catch (Exception e) {
      System.err.println("Server exception: " + e.toString());
      e.printStackTrace();
    }

    // Create and install a security manager
    /*
             if (System.getSecurityManager() == null) {
    	     System.setSecurityManager(new RMISecurityManager());
             }
    */
  }
Пример #18
0
  private Creator() throws RemoteException {
    Registry registry = LocateRegistry.createRegistry(1099);
    controllerImpl =
        new RemoteController() {
          @Override
          public void previewClosed() throws RemoteException {
            preview.setSelected(false);
          }

          @Override
          public void ready() throws RemoteException {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    initiateRemoteUIDefaults();
                  }
                });
          }

          @Override
          public void setTabIndex(int index) throws RemoteException {
            previewIndex = index;
          }
        };
    RemoteController controller =
        (RemoteController) UnicastRemoteObject.exportObject(controllerImpl, 0);
    registry.rebind(RemoteController.class.getName(), controller);
  }
Пример #19
0
  void register(String hostName, final int rmiPort, final int serverPort) {

    try {
      final ManagementImpl impl = (ManagementImpl) _persistit.getManagement();
      if (hostName == null && rmiPort != -1) {
        try {
          if (hostName == null) {
            final InetAddress addr = InetAddress.getLocalHost();
            try {
              hostName = addr.getHostName() + ":" + rmiPort;
            } catch (final Exception e) {
              hostName = addr.getHostAddress() + ":" + rmiPort;
            }
          }
        } catch (final NumberFormatException nfe) {
        }
      }
      if (rmiPort != -1 && _localRegistryPort != rmiPort) {
        LocateRegistry.createRegistry(rmiPort);
        _localRegistryPort = rmiPort;
      }

      if (hostName != null && hostName.length() > 0) {
        final String name = "//" + hostName + "/PersistitManagementServer";
        UnicastRemoteObject.exportObject(impl, serverPort);
        Naming.rebind(name, impl);
        impl._registered = true;
        impl._registeredHostName = hostName;
        _persistit.getLogBase().rmiServerRegistered.log(hostName);
      }
    } catch (final Exception exception) {
      _persistit.getLogBase().rmiRegisterException.log(hostName, exception);
    }
  }
 private static void publicizeRmiInterface(ModuleManager m, int registry_port)
     throws RemoteException {
   ModuleManagerRemote remote = (ModuleManagerRemote) UnicastRemoteObject.exportObject(m, 0);
   Registry reg = LocateRegistry.createRegistry(registry_port);
   logger.info("java RMI registry created.");
   reg.rebind(RMI_SERVER_NAME, remote);
 }
Пример #21
0
  public static void main(String[] args) throws NoSuchAlgorithmException {

    KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
    keyGen.initialize(1024);
    KeyPair par = keyGen.generateKeyPair();
    prk = par.getPrivate();
    pbk = par.getPublic();

    Registry reg = null;
    System.out.println("Creando conexion remota");
    try {
      reg = LocateRegistry.createRegistry(5555);
    } catch (Exception e) {
      e.printStackTrace();
    }
    System.out.println("Creando objeto servidor");
    Servidor s = new Servidor();
    try {
      reg.rebind("Operaciones", (InterfaceRemota) UnicastRemoteObject.exportObject(s, 0));
    } catch (Exception e) {
      e.printStackTrace();
    }
    while (true) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException ex) {
        Logger.getLogger(Servidor.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }
Пример #22
0
  public static void main(String[] args) {

    /** Atenção: Esses dois parametros são de grande importancia. */
    String enderecoIPLocal = "127.0.0.1";
    String nomeServidor = "Servidor";
    int porta = 2020;
    /*
     * ########################
     */

    System.out.println("Objeto remoto no endereco " + enderecoIPLocal);

    try {
      Servidor banco = new Servidor();

      // cria o registry para evitar problemas.
      Registry registry = LocateRegistry.createRegistry(porta);

      ServidorRemoto stubRemoto = (ServidorRemoto) UnicastRemoteObject.exportObject(banco, 0);

      String uriServidorRemoto = "rmi://" + nomeServidor;

      registry.rebind(uriServidorRemoto, stubRemoto);
      System.out.println("Objeto remoto exportado com nome " + uriServidorRemoto);
      System.out.println("\nObjeto remoto servidor do ar!");

    } catch (RemoteException e) {
      e.printStackTrace();
      System.exit(0);
    }
  }
Пример #23
0
  public static void main(String args[]) {

    /*
     * Create and install a security manager
     */
    //        if (System.getSecurityManager() == null) {
    //            System.setSecurityManager(new SecurityManager());
    //        }

    byte pattern = (byte) 0xAC;
    try {
      /*
       * Create remote object and export it to use
       * custom socket factories.
       */
      HelloImpl obj = new HelloImpl();
      RMIClientSocketFactory csf = new XorClientSocketFactory(pattern);
      RMIServerSocketFactory ssf = new XorServerSocketFactory(pattern);
      Hello stub = (Hello) UnicastRemoteObject.exportObject(obj, 0, csf, ssf);

      /*
       * Create a registry and bind stub in registry.
       */
      LocateRegistry.createRegistry(2002);
      Registry registry = LocateRegistry.getRegistry(2002);
      registry.rebind("Hello", stub);
      System.out.println("HelloImpl bound in registry");

    } catch (Exception e) {
      System.out.println("HelloImpl exception: " + e.getMessage());
      e.printStackTrace();
    }
  }
Пример #24
0
 public void init(List serviceList, ServerConfig serverConfig, MBeanServer mbeanServer) {
   System.setProperty("java.io.tmpdir", serverConfig.getCachedir());
   try {
     this.serviceList = serviceList;
     this.serverConfig = serverConfig;
     this.mbeanServer = mbeanServer;
     fsManager.init();
   } catch (Exception e) {
     log.error("Unable to initialie file system: " + fsManager, e);
   }
   try {
     registry = LocateRegistry.createRegistry(Integer.parseInt(serverConfig.getRmiregistryport()));
     ic = new InitialContext();
     Context subctx = null;
     try {
       subctx = (Context) ic.lookup("java:");
     } catch (Exception ex) {
       log.error("initializing the java context", ex);
       // ex.printStackTrace();
     }
     if (subctx == null) {
       ic.createSubcontext("java:");
     }
     remoteBindingInterface = new RemoteBindingObject(ic);
     Object jndilookupobj =
         UnicastRemoteObject.exportObject(
             remoteBindingInterface, Integer.parseInt(serverConfig.getRmiregistryport()));
     registry.rebind("RemoteBindingObject", (Remote) jndilookupobj);
   } catch (Exception ex) {
     log.error("error in registring to the remote binding object", ex);
     // e1.printStackTrace();
   }
   log.info("initialized");
 }
Пример #25
0
  public static void main(String args[]) throws Exception {
    try {
      testPkg.Server obj = new testPkg.Server();
      testPkg.Hello stub = (testPkg.Hello) UnicastRemoteObject.exportObject(obj, 0);
      // Bind the remote object's stub in the registry
      Registry registry = LocateRegistry.getRegistry(TestLibrary.READTEST_REGISTRY_PORT);
      registry.bind("Hello", stub);

      System.err.println("Server ready");

      // now, let's test client
      testPkg.Client client = new testPkg.Client(TestLibrary.READTEST_REGISTRY_PORT);
      String testStubReturn = client.testStub();
      if (!testStubReturn.equals(obj.hello)) {
        throw new RuntimeException("Test Fails : unexpected string from stub call");
      } else {
        System.out.println("Test passed");
      }
      registry.unbind("Hello");

    } catch (Exception e) {
      System.err.println("Server exception: " + e.toString());
      e.printStackTrace();
    }
  }
Пример #26
0
 public RemotePersonImpl(String name, String surname, String passportNumber)
     throws RemoteException {
   this.name = name;
   this.surname = surname;
   this.passportNumber = passportNumber;
   accounts = new ConcurrentHashMap<String, Account>();
   UnicastRemoteObject.exportObject(this, 0);
 }
Пример #27
0
  /**
   * Method exports and (re)binds a remote object with the registry
   *
   * @param name
   * @param obj
   * @return
   * @throws RemoteException
   * @throws AlreadyBoundException
   * @throws AccessException
   */
  public static Remote rebindService(String name, Remote obj)
      throws RemoteException, AlreadyBoundException, AccessException {

    Remote stub = UnicastRemoteObject.exportObject(obj, 0);
    checkStartRegistry().rebind(name, stub);
    System.out.println("ServiceUtil: Service '" + name + "' bound.");
    return stub;
  }
 static {
   Remote remote;
   try {
     remote = UnicastRemoteObject.exportObject(ourCook, 0);
   } catch (RemoteException e) {
     throw new IllegalStateException(e);
   }
   ourHand = remote;
 }
  void shutdownSpi() {
    server.stop();
    try {
      UnicastRemoteObject.unexportObject(this.debugger, true);
    } catch (Exception e) {
    }

    RmiDebuggedEnvironmentImpl.cleanup();
  }
Пример #30
0
 private void stopRegistry() {
   if (_registry != null) {
     try {
       UnicastRemoteObject.unexportObject(_registry, true);
     } catch (Exception ex) {
       LOG.ignore(ex);
     }
   }
 }