java.rmi.Naming.lookup()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(482)

本文整理了Java中java.rmi.Naming.lookup()方法的一些代码示例,展示了Naming.lookup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Naming.lookup()方法的具体详情如下:
包路径:java.rmi.Naming
类名称:Naming
方法名:lookup

Naming.lookup介绍

暂无

代码示例

代码示例来源:origin: apache/geode

private static synchronized void initialize() throws Exception {
 if (blackboard == null) {
  System.out.println(
    DUnitLauncher.RMI_PORT_PARAM + "=" + System.getProperty(DUnitLauncher.RMI_PORT_PARAM));
  int namingPort = Integer.getInteger(DUnitLauncher.RMI_PORT_PARAM).intValue();
  String name = "//localhost:" + namingPort + "/" + "InternalBlackboard";
  try {
   blackboard = (InternalBlackboard) Naming.lookup(name);
  } catch (NotBoundException e) {
   // create the master blackboard in this VM
   blackboard = new InternalBlackboardImpl();
   Naming.bind(name, blackboard);
  }
 }
}

代码示例来源:origin: spring-projects/spring-framework

stub = Naming.lookup(getServiceUrl());

代码示例来源:origin: decaywood/XueQiuSuperSpider

protected Object getRMIProxy() throws RemoteException, NotBoundException, MalformedURLException {
  Entry<String, Integer> entry = slaveChooser.chooseSlave();
  String slaveIP = entry.getKey();
  int port = entry.getValue();
  System.out.println(getInvokeURL(slaveIP, port));
  return Naming.lookup(getInvokeURL(slaveIP, port));
}

代码示例来源:origin: org.springframework/spring-context

stub = Naming.lookup(getServiceUrl());

代码示例来源:origin: apache/geode

.lookup("//localhost:" + namingPort + "/" + DUnitLauncher.MASTER_PARAM);
DUnitLauncher.init(holder);
DUnitLauncher.locatorPort = holder.getLocatorPort();

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like.
 * They will simply replace the ones that were there.
 */
public CachePeer lookupRemoteCachePeer(String url) throws MalformedURLException, NotBoundException, RemoteException {
  LOG.debug("Lookup URL {}", url);
  CachePeer cachePeer = (CachePeer) Naming.lookup(url);
  return cachePeer;
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

/**
 * Returns the <code>RemoteBlockingQueue</code> used by this test.
 */
protected RemoteBlockingQueue getQueue() throws Exception {
 return (RemoteBlockingQueue) Naming.lookup(this.queueURL);
}

代码示例来源:origin: com.github.rjolly/remote4j

@SuppressWarnings("unchecked")
public <T> Remote<T> lookup(final String name) throws MalformedURLException, RemoteException, NotBoundException {
  return (Remote<T>) Naming.lookup(name);
}

代码示例来源:origin: int.esa.ccsds.mo/TRANSPORT_RMI

/**
 * Constructor.
 *
 * @param remoteRootURI The remote RMI object URI.
 * @throws NotBoundException If remote RMI object no bound.
 * @throws MalformedURLException If URI not correct.
 * @throws RemoteException If there is a remote error.
 */
public RMIMessageSender(String remoteRootURI) throws NotBoundException, MalformedURLException, RemoteException
{
 this.remoteURI = remoteRootURI;
 destinationRMI = (RMIReceiveInterface) Naming.lookup(remoteURI);
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like.
 * They will simply replace the ones that were there.
 */
public CachePeer lookupRemoteCachePeer(String url) throws MalformedURLException, NotBoundException, RemoteException {
  LOG.debug("Lookup URL {}", url);
  CachePeer cachePeer = (CachePeer) Naming.lookup(url);
  return cachePeer;
}

代码示例来源:origin: stackoverflow.com

import java.rmi.Naming;

public class RmiClient { 
 public static void main(String args[]) throws Exception {
  RmiServerIntf obj = (RmiServerIntf)Naming.lookup("//localhost/RmiServer");
  System.out.println(obj.getMessage()); 
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like.
 * They will simply replace the ones that were there.
 */
public CachePeer lookupRemoteCachePeer(String url) throws MalformedURLException, NotBoundException, RemoteException {
  LOG.debug("Lookup URL {}", url);
  CachePeer cachePeer = (CachePeer) Naming.lookup(url);
  return cachePeer;
}

代码示例来源:origin: graphstream/gs-core

public void register(String url) throws RemoteException {
  try {
    RMIAdapterIn in = (RMIAdapterIn) Naming.lookup(url);
    if (in != null)
      inputs.put(url, in);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: apache/jackrabbit

protected RemoteRepository getRemoteRepository()
    throws RemoteException {
  try {
    return (RemoteRepository) Naming.lookup(url);
  } catch (MalformedURLException e) {
    throw new RemoteException("Malformed URL: " + url, e);
  } catch (NotBoundException e) {
    throw new RemoteException("No target found: " + url, e);
  } catch (ClassCastException e) {
    throw new RemoteException("Unknown target: " + url, e);
  }
}

代码示例来源:origin: IanDarwin/javasrc

public EvalClient() {
  try {
    netConn = (NetEvaluation)Naming.lookup("//"+SERVER+"/EvalServer");
  } catch (Exception e) {
    System.err.println("NetEvaluation exception: " + e.getMessage());
    e.printStackTrace();
  }
}

代码示例来源:origin: com.github.emc-mongoose/mongoose-api-model

@SuppressWarnings("unchecked")
public static <S extends Service> S resolve(
  final String addr, final int port, final String name
) throws NotBoundException, IOException, URISyntaxException {
  final String svcUri = getRemoteSvcUri(addr, port, name).toString();
  return (S) Naming.lookup(svcUri);
}

代码示例来源:origin: com.synaptix/SynaptixProcessManagerCore

private void rebind() {
  if (System.getSecurityManager() == null) {
    System.setSecurityManager(new PESecurityManager());
  }
  try {
    remoteHandler = (RemoteMessageHandler) Naming.lookup(bindname);
    System.out.println(remoteHandler.toString());
    System.out.println("Channel proxy bound on " + bindname);
    retryFailures();
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: apache/ofbiz-framework

public ExampleRemoteClient() {
  try {
    rd = (RemoteDispatcher) Naming.lookup(RMI_URL);
  } catch (NotBoundException e) {
    e.printStackTrace();
  } catch (MalformedURLException e) {
    e.printStackTrace();
  } catch (RemoteException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: io.snappydata/gemfire-hydra-tests

@Override
protected void setUp() throws Exception {
 super.setUp();
 showSystemState(getSystemPropertyFilter());
 final String serviceUrl = getServiceUrl();
 Sys.out("Phone Directory Service URL ({0})", serviceUrl);
 service = (PhoneDirectoryService) Naming.lookup(serviceUrl);
}

代码示例来源:origin: com.akiban/akiban-persistit

private boolean connect(final String rmiHost) {
  try {
    _rmiHost = rmiHost;
    final Management management = (Management) Naming.lookup("//" + rmiHost + "/PersistitManagementServer");
    setManagement(management);
    setFrameTitle(rmiHost);
    return true;
  } catch (final Exception e) {
    setManagement(null);
    showMessage(e, getProperty("ConnectionFailedMessage"), JOptionPane.ERROR_MESSAGE);
    return false;
  }
}

相关文章