Package java.rmi.registry

Examples of java.rmi.registry.Registry


     */
    public void rexit() throws RemoteException {
        log.info("Exitting");
        backingEngine.exit();
        // Tidy up any objects we created
        Registry reg = LocateRegistry.getRegistry(this.rmiPort);       
        try {
            reg.unbind(JMETER_ENGINE_RMI_NAME);
        } catch (NotBoundException e) {
            log.warn(JMETER_ENGINE_RMI_NAME+" is not bound",e);
        }
        log.info("Unbound from registry");
        // Help with garbage control
View Full Code Here


        String agentName = args[0];
        String registryHost = args[1];
        int registryPort = Integer.parseInt(args[2]);
        String processManagerName = args[3];

        Registry reg = LocateRegistry.getRegistry(registryHost, registryPort);

        final ProcessAgentImpl agent = new ProcessAgentImpl();
        ProcessManagerRemoteIF manager = (ProcessManagerRemoteIF) reg.lookup(processManagerName);
        agent.init(agentName,manager);
    }
View Full Code Here

        String agentName = args[0];
        String registryHost = args[1];
        int registryPort = Integer.parseInt(args[2]);
        String processManagerName = args[3];

        Registry reg = LocateRegistry.getRegistry(registryHost, registryPort);

        final ProcessAgentImpl agent = new ProcessAgentImpl();

        agent.shutdownHook = new Thread(new Runnable() {
                public void run() {
                    agent.shutdownCountDown.release();
                    try {
                        agent.mainThread.join();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
        });
        Runtime.getRuntime().addShutdownHook(agent.shutdownHook);

        ProcessManagerRemoteIF manager = (ProcessManagerRemoteIF) reg.lookup(processManagerName);
        agent.init(agentName,manager);

        agent.waitForShutdown();
        agent.notifyManagerOnExit();
        if(agent.exitedFromParent) {
View Full Code Here

            throw new ServletException("Unable to create RMI repository. jcr-rmi.jar might be missing.", e);
        }

        try {
            System.setProperty("java.rmi.server.useCodebaseOnly", "true");
            Registry reg = null;

            // first try to create the registry, which will fail if another
            // application is already running on the configured host/port
            // or if the rmiHost is not local
            try {
                // find the server socket factory: use the default if the
                // rmiHost is not configured
                RMIServerSocketFactory sf;
                if (rmiHost.length() > 0) {
                    log.debug("Creating RMIServerSocketFactory for host " + rmiHost);
                    InetAddress hostAddress = InetAddress.getByName(rmiHost);
                    sf = getRMIServerSocketFactory(hostAddress);
                } else {
                    // have the RMI implementation decide which factory is the
                    // default actually
                    log.debug("Using default RMIServerSocketFactory");
                    sf = null;
                }

                // create a registry using the default client socket factory
                // and the server socket factory retrieved above. This also
                // binds to the server socket to the rmiHost:rmiPort.
                reg = LocateRegistry.createRegistry(rmiPort, null, sf);

            } catch (UnknownHostException uhe) {
                // thrown if the rmiHost cannot be resolved into an IP-Address
                // by getRMIServerSocketFactory
                log.info("Cannot create Registry", uhe);
            } catch (RemoteException e) {
                // thrown by createRegistry if binding to the rmiHost:rmiPort
                // fails, for example due to rmiHost being remote or another
                // application already being bound to the port
                log.info("Cannot create Registry", e);
            }

            // if creation of the registry failed, we try to access an
            // potentially active registry. We do not check yet, whether the
            // registry is actually accessible.
            if (reg == null) {
                log.debug("Trying to access existing registry at " + rmiHost
                    + ":"+ rmiPort);
                try {
                    reg = LocateRegistry.getRegistry(rmiHost, rmiPort);
                } catch (RemoteException re) {
                    log.error("Cannot create the reference to the registry at "
                        + rmiHost + ":" + rmiPort, re);
                }
            }

            // if we finally have a registry, register the repository with the
            // rmiName
            if (reg != null) {
                log.debug("Registering repository as " + rmiName
                    + " to registry " + reg);
                reg.bind(rmiName, remote);

                // when successfull, keep references
                this.rmiURI = rmiURI;
                this.rmiRepository = remote;
                log.info("Repository bound via RMI with name: " + rmiURI);
View Full Code Here

    }

    private Registry createRmiRegistry(int jmxPortRegistryServer, boolean useCustomRmiRegistry)
            throws RemoteException
    {
        Registry rmiRegistry;
        if(useCustomRmiRegistry)
        {
            _log.debug("Using custom RMIServerSocketFactory");
            rmiRegistry = LocateRegistry.createRegistry(jmxPortRegistryServer, null, new CustomRMIServerSocketFactory());
        }
View Full Code Here

                return;
            }

            try {
                // check whether we have a private registry already
                Registry registry = RmiRegistrationSupport.this.getPrivateRegistry();
                if (registry != null) {
                    registry.bind(rmiName, this.rmiRepository);
                    this.rmiName = rmiName;
                    RmiRegistrationSupport.this.log(LogService.LOG_INFO,
                        "Repository bound to " + this.getRmiURL(), null);
                }
View Full Code Here

     *
     * @param hostName
     * @throws Exception
     */
    public static void enableHost(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);

        impl.enableHost(hostName);
    }
View Full Code Here

     *
     * @param hostName
     * @throws Exception
     */
    public static void disableHost(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);

        impl.disableHost(hostName);
    }
View Full Code Here

     *
     * @param hostName
     * @throws Exception
     */
    public static void removeHost(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);

        impl.removeHost(hostName);
    }
View Full Code Here

     * @param hostName
     * @return
     * @throws Exception
     */
    public static boolean exists(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.exists(hostName);
    }
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.