/** * Starts an RMI Registry that allows clients to lookup the JMX IP/port. * * @param port rmi port to use * @throws IOException */ private void startRmiRegistry(int port) throws IOException { rmiRegistry = LocateRegistry.createRegistry(port); }
/** * Locate or create the RMI registry for this exporter. * @param registryPort the registry port to use * @return the RMI registry * @throws RemoteException if the registry couldn't be located or created */ protected Registry getRegistry(int registryPort) throws RemoteException { if (this.alwaysCreateRegistry) { logger.debug("Creating new RMI registry"); return LocateRegistry.createRegistry(registryPort); } if (logger.isDebugEnabled()) { logger.debug("Looking for RMI registry at port '" + registryPort + "'"); } synchronized (LocateRegistry.class) { try { // Retrieve existing registry. Registry reg = LocateRegistry.getRegistry(registryPort); testRegistry(reg); return reg; } catch (RemoteException ex) { logger.trace("RMI registry access threw exception", ex); logger.debug("Could not detect RMI registry - creating new one"); // Assume no registry found -> create new one. return LocateRegistry.createRegistry(registryPort); } } }
logger.debug("Creating new RMI registry"); this.created = true; return LocateRegistry.createRegistry(registryPort); return LocateRegistry.createRegistry(registryPort);
/** * Starts this MBean: rmiregistry can now accept incoming calls * * @see #stop * @see #isRunning */ @Override public synchronized void start() throws RemoteException { if (!isRunning()) { if (ssf != null) { registry = LocateRegistry.createRegistry(port, null, // RMIClientSocketFactory ssf); // RMIServerSocketFactory } else { registry = LocateRegistry.createRegistry(port); } isRunning = true; } }
if (this.alwaysCreateRegistry) { logger.debug("Creating new RMI registry"); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory); logger.debug("Could not detect RMI registry - creating new one"); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
logger.debug("Creating new RMI registry"); this.created = true; return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
/** * Locate or create the RMI registry for this exporter. * @param registryPort the registry port to use * @return the RMI registry * @throws RemoteException if the registry couldn't be located or created */ protected Registry getRegistry(int registryPort) throws RemoteException { if (this.alwaysCreateRegistry) { logger.debug("Creating new RMI registry"); return LocateRegistry.createRegistry(registryPort); } if (logger.isDebugEnabled()) { logger.debug("Looking for RMI registry at port '" + registryPort + "'"); } synchronized (LocateRegistry.class) { try { // Retrieve existing registry. Registry reg = LocateRegistry.getRegistry(registryPort); testRegistry(reg); return reg; } catch (RemoteException ex) { logger.trace("RMI registry access threw exception", ex); logger.debug("Could not detect RMI registry - creating new one"); // Assume no registry found -> create new one. return LocateRegistry.createRegistry(registryPort); } } }
logger.debug("Creating new RMI registry"); this.created = true; return LocateRegistry.createRegistry(registryPort); return LocateRegistry.createRegistry(registryPort);
if (this.alwaysCreateRegistry) { logger.debug("Creating new RMI registry"); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory); logger.debug("Could not detect RMI registry - creating new one"); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
logger.debug("Creating new RMI registry"); this.created = true; return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory); return LocateRegistry.createRegistry(registryPort, clientSocketFactory, serverSocketFactory);
BuildDaemon(boolean incremental) throws RemoteException { super(); this.incremental = incremental; Random random = new Random(); for (int i = 0; i < 20; ++i) { port = random.nextInt(MAX_PORT - MIN_PORT) + MIN_PORT; try { registry = LocateRegistry.createRegistry(port); } catch (RemoteException e) { continue; } try { registry.bind(RemoteBuildService.ID, this); } catch (RemoteException | AlreadyBoundException e) { throw new IllegalStateException("Could not bind remote build assistant service", e); } setupIncrementalCache(); return; } throw new IllegalStateException("Could not create RMI registry"); }
public void asRMISlave() { try { //创建并导出接受指定port请求的本地主机上的Registry实例。 String[] address = GlobalSystemConfigLoader.getRMIConfig("slave_rcv_ip").split(":"); String slaveIP = address[0].trim(); int port = Integer.parseInt(address[1].trim()); System.setProperty("java.rmi.server.hostname", slaveIP); LocateRegistry.createRegistry(port); /** * Naming 类提供在对象注册表中存储和获得远程对远程对象引用的方法 * Naming 类的每个方法都可将某个名称作为其一个参数 * 该名称是使用以下形式的 URL 格式(没有 scheme 组件)的 java.lang.String: * rmi://host:port/name * host:注册表所在的主机(远程或本地),省略则默认为本地主机 * port:是注册表接受调用的端口号,省略则默认为1099,RMI注册表registry使用的著名端口 * name:是未经注册表解释的简单字符串 */ Naming.rebind(getInvokeURL(slaveIP, port), this); System.out.println("RMI Slave 启动成功" + " URL: " + getInvokeURL(slaveIP, port)); }catch(Exception e){ e.printStackTrace(); System.out.println("RMI Slave 创建失败"); } }
if (registry == null) { LOG.debug("Creating RMIRegistry on port {}", connectorPort); registry = LocateRegistry.createRegistry(connectorPort);
rmiRegistry = LocateRegistry.createRegistry(rmiRegistryPort);
final RemoteOperations toBeStubbed = holdStrongReference ? classVariable : methodVariable; final Remote remote = UnicastRemoteObject.exportObject(toBeStubbed, 0); final Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT); registry.bind(REMOTE_NAME, remote);
public static Map createRmiRegistry(int initPort) { Map<String, Object> result = new HashMap<String, Object>(2); int counter = 0; int port = initPort; Registry reg = null; while (reg == null && counter <= 4) { try { reg = LocateRegistry.createRegistry(port); result.put("registry", reg); result.put("port", port); break; } catch (RemoteException ex) { counter++; port = port + 1; System.out.println("JmxBuilder - *** FAILED *** to create RMI Registry - Will Retry on port [" + port + "]."); try { Thread.currentThread().sleep(500); } catch (InterruptedException e) { throw new RuntimeException(e); } } } return result; }
LocateRegistry.createRegistry(jmxPort); System.out.println("RMI registry ready."); } catch (Exception e) {
Registry registry = LocateRegistry.createRegistry(namingPort); System.setProperty(RMI_PORT_PARAM, "" + namingPort);
registry.list(); } catch (Exception e) { registry = LocateRegistry.createRegistry(resources .getRMIRegistryPort()); QuartzSchedulerResources.CREATE_REGISTRY_ALWAYS)) { try { registry = LocateRegistry.createRegistry(resources .getRMIRegistryPort()); } catch (Exception e) {
registry.list(); } catch (Exception e) { registry = LocateRegistry.createRegistry(resources .getRMIRegistryPort()); QuartzSchedulerResources.CREATE_REGISTRY_ALWAYS)) { try { registry = LocateRegistry.createRegistry(resources .getRMIRegistryPort()); } catch (Exception e) {