Package java.rmi.registry

Examples of java.rmi.registry.Registry


     * @param hostName
     * @return
     * @throws Exception
     */
    public static boolean isEnabled(String hostName) throws Exception {
        Registry myRegistry = LocateRegistry.getRegistry("127.0.0.1", port);
        com.groupon.odo.proxylib.hostsedit.rmi.Message impl = (com.groupon.odo.proxylib.hostsedit.rmi.Message) myRegistry.lookup(SERVICE_NAME);

        return impl.isEnabled(hostName);
    }
View Full Code Here


     * @return
     * @throws Exception
     */
    public static boolean isAvailable() throws Exception {
        try {
            Registry myRegistry = LocateRegistry.getRegistry("127.0.0.1", port);
            com.groupon.odo.proxylib.hostsedit.rmi.Message impl = (com.groupon.odo.proxylib.hostsedit.rmi.Message) myRegistry.lookup(SERVICE_NAME);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

                receivedMessages.add(message);
            }
        };

        // Create server notified by the filter
        final Registry registry = LocateRegistry.createRegistry(4001);
        registry.bind(RMIBroadcastService.class.getSimpleName() + "/RMITopic", service);

        // Create broadcaster
        final AtmosphereConfig config = new AtmosphereFramework().getAtmosphereConfig();
        final DefaultBroadcasterFactory factory = new DefaultBroadcasterFactoryForTest(DefaultBroadcaster.class, "NEVER", config);
        config.framework().setBroadcasterFactory(factory);
View Full Code Here

        String serviceName = args[i++];
        String sge_url = args[i++];
       
        try {
           
            Registry reg = null;
            if(registryHost == null) {
                reg = LocateRegistry.getRegistry();
            } else if (registryHost.equals("local")) {
                reg = LocateRegistry.createRegistry(registryPort);
                logger.info("local registry at port " + registryPort + " created" );
            } else if ( registryPort == 0 ) {
                logger.info("Get registry from " + registryHost);
                reg = LocateRegistry.getRegistry(registryHost);
            } else {
                logger.info("Get registry from " + registryHost + ":" + registryPort);
                reg = LocateRegistry.getRegistry(registryHost, registryPort);
            }
            JGDIRemoteFactoryImpl service = new JGDIRemoteFactoryImpl(sge_url);
            Thread.sleep(1000);
            Remote stub = (Remote)UnicastRemoteObject.exportObject(service, 0);
           
            reg.bind(serviceName, stub);
           
            logger.info("JGDIRemoteFactory bound to name " + serviceName );
           
            ShutdownHook shutdownHook = new ShutdownHook(reg, serviceName);
            Runtime.getRuntime().addShutdownHook(shutdownHook);
View Full Code Here

      Naming.rebind(name, obj);
    } catch (RemoteException ex){
      ex.printStackTrace();
      if (create) {
        System.out.println("No registry found. Creating one.");
        Registry r = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
        r.rebind(name, obj);
      } else throw ex;
    }
  }
View Full Code Here

   * @throws RemoteException if an error occurs while trying to retrieve the ResultChannel object
   */ 
  private static void connectToResultChannel () throws RemoteException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "connectToResultChannel");
   
    Registry r = LocateRegistry.getRegistry (registryHost, registryPort);
   
    try {
      resultChannel = (ResultChannel)r.lookup (ResultChannel.LOOKUP_NAME);
    }
    catch (NotBoundException e) {
      log.throwing ("com.sun.grid.jgrid.server.JCEPHandler", "connectToResultChannel", e);
     
      throw new RemoteException ("Unable to bind to result channel", e);
View Full Code Here

    try {
      Naming.rebind (name, obj);
    } catch (RemoteException ex){
      if (create) {
        ex.printStackTrace ();
        Registry r = LocateRegistry.createRegistry (Registry.REGISTRY_PORT);
        r.rebind (name, obj);
      } else throw ex;
    }
  }
View Full Code Here

    HashMap lockbox = new HashMap ();
   
    lockbox.put ("MyJob", new Object ());
   
    ResultChannel resultChannel = new ResultChannelImpl (lockbox);
    Registry r = LocateRegistry.createRegistry (ResultChannel.PORT);
    r.rebind (ResultChannel.LOOKUP_NAME, resultChannel);
  }
View Full Code Here

   
    //Prepare the return data channel
    log.log (Level.FINEST, "Registering ResultChannel");
    try {
      resultChannel = new ResultChannelImpl (lockbox);
      Registry r = LocateRegistry.createRegistry (ResultChannel.PORT);
      r.rebind (ResultChannel.LOOKUP_NAME, resultChannel);
    }
    catch (RemoteException e) {
      log.severe ("Unable to establish return data channel: " + e.getMessage ());
      log.throwing ("com.sun.grid.jgrid.proxy.ComputeProxy", "main", e);
     
View Full Code Here

  /** This method retrieves the ResultChannel object from the registry.
   * @param resultHost the host with the registry containing the ResultChannel
   * @throws RemoteException if an error occurs while trying to retrieve the ResultChannel object
   */ 
  private void connectToResultChannel (String resultHost) throws RemoteException {
    Registry r = LocateRegistry.getRegistry(resultHost, ResultChannel.PORT);
   
    try {
      resultChannel = (ResultChannel)r.lookup(ResultChannel.LOOKUP_NAME);
    }
    catch (NotBoundException e) {
      throw new RemoteException("Unable to bind to result channel");
    }
  }
View Full Code Here

TOP

Related Classes of java.rmi.registry.Registry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.