本文整理了Java中java.rmi.registry.Registry.lookup
方法的一些代码示例,展示了Registry.lookup
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.lookup
方法的具体详情如下:
包路径:java.rmi.registry.Registry
类名称:Registry
方法名:lookup
[英]Returns the remote reference bound to the specified name
in this registry.
[中]返回绑定到此注册表中指定name
的远程引用。
代码示例来源:origin: stackoverflow.com
Registry registry =
LocateRegistry.getRegistry("localhost",
Registry.REGISTRY_PORT);
EchoServer es = (EchoServer)registry.lookup("echo");
System.err.println("es: " + es);
System.out.println(es.echo("hallo"));
代码示例来源:origin: apache/geode
public RemoteDUnitVMIF getStub(String version, int i)
throws RemoteException, NotBoundException, InterruptedException {
waitForVMs(DUnitLauncher.STARTUP_TIMEOUT);
return (RemoteDUnitVMIF) registry.lookup("vm" + i);
}
代码示例来源:origin: quartz-scheduler/quartz
protected RemotableQuartzScheduler getRemoteScheduler()
throws SchedulerException {
if (rsched != null) {
return rsched;
}
try {
Registry registry = LocateRegistry.getRegistry(rmiHost, rmiPort);
rsched = (RemotableQuartzScheduler) registry.lookup(schedId);
} catch (Exception e) {
SchedulerException initException = new SchedulerException(
"Could not get handle to remote scheduler: "
+ e.getMessage(), e);
throw initException;
}
return rsched;
}
代码示例来源:origin: quartz-scheduler/quartz
protected RemotableQuartzScheduler getRemoteScheduler()
throws SchedulerException {
if (rsched != null) {
return rsched;
}
try {
Registry registry = LocateRegistry.getRegistry(rmiHost, rmiPort);
rsched = (RemotableQuartzScheduler) registry.lookup(schedId);
} catch (Exception e) {
SchedulerException initException = new SchedulerException(
"Could not get handle to remote scheduler: "
+ e.getMessage(), e);
throw initException;
}
return rsched;
}
代码示例来源:origin: spring-projects/spring-framework
stub = registry.lookup(name);
代码示例来源:origin: apache/geode
@Override
public BounceResult bounce(String version, int pid, boolean force) {
processManager.bounce(version, pid, force);
try {
if (!processManager.waitForVMs(DUnitLauncher.STARTUP_TIMEOUT)) {
throw new RuntimeException(DUnitLauncher.STARTUP_TIMEOUT_MESSAGE);
}
RemoteDUnitVMIF remote =
(RemoteDUnitVMIF) registry.lookup(VM.getVMName(VersionManager.CURRENT_VERSION, pid));
return new BounceResult(pid, remote);
} catch (RemoteException | NotBoundException e) {
throw new RuntimeException("could not lookup name", e);
} catch (InterruptedException e) {
throw new RuntimeException("Failed waiting for VM", e);
}
}
}
代码示例来源:origin: stackoverflow.com
RMIServer jmxrmiServer = (RMIServer)registry.lookup("jmxrmi");
System.out.println(jmxrmiServer.toString());
代码示例来源:origin: patric-r/jvmtop
sslRMIClientSocketFactory);
try {
stub = (RMIServer) registry.lookup("jmxrmi");
} catch (NotBoundException nbe) {
throw (IOException)
LocateRegistry.getRegistry(registryHostName, registryPort);
try {
stub = (RMIServer) registry.lookup("jmxrmi");
} catch (NotBoundException nbe) {
throw (IOException)
代码示例来源:origin: stackoverflow.com
final Remote remote = registry.lookup(REMOTE_NAME);
final RemoteOperations stub = RemoteOperations.class.cast(remote);
final String message = stub.remoteOperation();
代码示例来源:origin: apache/geode
private static int startLocator(Registry registry) throws IOException, NotBoundException {
RemoteDUnitVMIF remote = (RemoteDUnitVMIF) registry.lookup("vm" + LOCATOR_VM_NUM);
final File locatorLogFile =
LOCATOR_LOG_TO_DISK ? new File("locator-" + locatorPort + ".log") : new File("");
代码示例来源:origin: aragozin/jvm-tools
Registry registry = LocateRegistry.getRegistry(host, port, new SslRMIClientSocketFactory());
try {
rmiServer = (RMIServer) registry.lookup("jmxrmi");
} catch (NotBoundException nbe) {
throw (IOException)
Registry registry = LocateRegistry.getRegistry(host, port);
try {
rmiServer = (RMIServer) registry.lookup("jmxrmi");
} catch (NotBoundException nbe) {
System.out.println("Failed using LocateRegistry. Fallback to JMXConnectorFactory");
代码示例来源:origin: org.springframework/spring-context
stub = registry.lookup(name);
代码示例来源:origin: konsoletyper/teavm
private void executeInSeparateProcess() throws MojoExecutionException {
DaemonInfo daemon;
try {
daemon = BuildDaemon.start(false, processMemory, new DaemonLogImpl(), createDaemonClassPath());
} catch (Throwable e) {
throw new MojoExecutionException("Error starting TeaVM process", e);
}
try {
RemoteBuildService buildService;
try {
Registry registry = LocateRegistry.getRegistry(daemon.getPort());
buildService = (RemoteBuildService) registry.lookup(RemoteBuildService.ID);
} catch (RemoteException | NotBoundException e) {
throw new MojoExecutionException("Error connecting TeaVM process", e);
}
RemoteBuildStrategy builder = new RemoteBuildStrategy(buildService);
executeWithBuilder(builder);
} finally {
daemon.getProcess().destroy();
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Returns a reference to the remote object.
*
* @param name the name of the cache e.g. <code>sampleCache1</code>
*/
protected Remote lookupPeer(String name) throws CacheException {
try {
return registry.lookup(name);
} catch (Exception e) {
throw new CacheException("Unable to lookup peer for replicated cache " + name + " "
+ e.getMessage());
}
}
代码示例来源:origin: org.jwall/stream-runtime
@SuppressWarnings("unchecked")
public static <T extends Service> T lookup(String name,
Class<T> serviceClass) throws Exception {
RemoteEndpoint re = (RemoteEndpoint) registry.lookup(name);
Service service = (Service) Proxy.newProxyInstance(re.getClass()
.getClassLoader(), new Class<?>[] { serviceClass },
new ServiceDelegator(re));
return (T) service;
}
代码示例来源:origin: stackoverflow.com
ClientCallbackInterface client = new ClientImpl();
UnicastRemoteObject.exportObject(client);
Registry registry = LocateRegistry.getRegistry(serverIp, serverRegistryPort);
Server server = (Server) registry.lookup(serviceName);
server.register(client);
代码示例来源:origin: org.jboss.resteasy/resteasy-eagledns-fork
public static EagleManager getManager(String host, int port, String password) throws RemoteException, NotBoundException {
Registry registry = LocateRegistry.getRegistry(host,port);
EagleLogin eagleLogin = (EagleLogin) registry.lookup("eagleLogin");
return eagleLogin.login(password);
}
代码示例来源:origin: org.fosstrak.llrp/llrp-adaptor
private Adaptor getRemoteAdapter(String address) throws LLRPRuntimeException, RemoteException {
try {
// try to get the instance from the remote
// adaptor.
Registry registry = LocateRegistry.getRegistry(address, Constants.REGISTRY_PORT);
return (Adaptor) registry.lookup(Constants.ADAPTOR_NAME_IN_REGISTRY);
} catch (NotBoundException ex) {
throw new LLRPRuntimeException("Could not get a handle on the remote adaptor", ex);
}
}
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
public void init(Registry registry) throws AccessException, RemoteException, NotBoundException {
for(int i = 0; i < numVms; i++) {
RemoteTestModuleIF remote = (RemoteTestModuleIF) registry.lookup("vm" + i);
addVM(i, "vm" + i, remote);
}
//for ease of debugging, add another VM that is the local host.
addVM(numVms, "vm" + numVms, new FakeRemoteTestModule(Log.getLogWriter()));
addLocator(numVms+1, "vm" + numVms + 1, (RemoteTestModuleIF) registry.lookup("vm" + NUM_VMS));
addHost(this);
}
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
protected Pingable getPingableService(final ConsoleContext context) throws NotBoundException, RemoteException {
final Registry registry = context.getRegistry();
final Remote remoteObject = registry.lookup(getServiceName());
Assert.notNull(remoteObject, "The remote object was null!");
Assert.instanceOf(remoteObject, Pingable.class, "The remote object must be an instance of Pingable to invoke this command!");
return (Pingable) remoteObject;
}
内容来源于网络,如有侵权,请联系作者删除!