java.rmi.registry.Registry.list()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(111)

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

Registry.list介绍

[英]Returns an array of the names bound in this registry. The array will contain a snapshot of the names bound in this registry at the time of the given invocation of this method.
[中]返回此注册表中绑定的名称数组。该数组将包含在给定的方法调用时绑定到此注册表中的名称的快照。

代码示例

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

/**
 * Test the given RMI registry, calling some operation on it to
 * check whether it is still active.
 * <p>Default implementation calls {@code Registry.list()}.
 * @param registry the RMI registry to test
 * @throws RemoteException if thrown by registry methods
 * @see java.rmi.registry.Registry#list()
 */
protected void testRegistry(Registry registry) throws RemoteException {
  registry.list();
}

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

/**
 * Test the given RMI registry, calling some operation on it to
 * check whether it is still active.
 * <p>Default implementation calls {@code Registry.list()}.
 * @param registry the RMI registry to test
 * @throws RemoteException if thrown by registry methods
 * @see java.rmi.registry.Registry#list()
 */
protected void testRegistry(Registry registry) throws RemoteException {
  registry.list();
}

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

/**
 * Test the given RMI registry, calling some operation on it to
 * check whether it is still active.
 * <p>Default implementation calls {@code Registry.list()}.
 * @param registry the RMI registry to test
 * @throws RemoteException if thrown by registry methods
 * @see java.rmi.registry.Registry#list()
 */
protected void testRegistry(Registry registry) throws RemoteException {
  registry.list();
}

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

/**
 * Test the given RMI registry, calling some operation on it to
 * check whether it is still active.
 * <p>Default implementation calls {@code Registry.list()}.
 * @param registry the RMI registry to test
 * @throws RemoteException if thrown by registry methods
 * @see java.rmi.registry.Registry#list()
 */
protected void testRegistry(Registry registry) throws RemoteException {
  registry.list();
}

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

/**
 * Returns an array of the names bound in the rmiregistry
 *
 * @return an array of the names bound in the rmiregistry
 * @see java.rmi.registry.Registry#list()
 */
@Override
public String[] list() throws RemoteException {
 if (!isRunning()) {
  throw new IllegalStateException("RMIRegistryService is not running");
 }
 return registry.list();
}

代码示例来源:origin: frohoff/ysoserial

public static void main(final String[] args) throws Exception {
  final String host = args[0];
  final int port = Integer.parseInt(args[1]);
  final String command = args[3];
  Registry registry = LocateRegistry.getRegistry(host, port);
  final String className = CommonsCollections1.class.getPackage().getName() +  "." + args[2];
  final Class<? extends ObjectPayload> payloadClass = (Class<? extends ObjectPayload>) Class.forName(className);
  // test RMI registry connection and upgrade to SSL connection on fail
  try {
    registry.list();
  } catch(ConnectIOException ex) {
    registry = LocateRegistry.getRegistry(host, port, new RMISSLClientSocketFactory());
  }
  // ensure payload doesn't detonate during construction or deserialization
  exploit(registry, payloadClass, command);
}

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

String[] names = registry.list();
for (String name : names) {
  System.out.println("In the registry: " + name);

代码示例来源:origin: quartz-scheduler/quartz

registry.list();
} catch (Exception e) {
  registry = LocateRegistry.createRegistry(resources

代码示例来源:origin: quartz-scheduler/quartz

registry.list();
} catch (Exception e) {
  registry = LocateRegistry.createRegistry(resources

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

/**
 * Start the rmiregistry.
 * <p>
 * The alternative is to use the <code>rmiregistry</code> binary, in which case:
 * <ol>
 * <li>rmiregistry running
 * <li>-Djava.rmi.server.codebase="file:///Users/gluck/work/ehcache/build/classes/ file:///Users/gluck/work/ehcache/lib/commons-logging-1.0.4.jar"
 * </ol>
 *
 * @throws RemoteException
 */
protected void startRegistry() throws RemoteException {
  try {
    registry = LocateRegistry.getRegistry(port.intValue());
    try {
      registry.list();
    } catch (RemoteException e) {
      //may not be created. Let's create it.
      registry = LocateRegistry.createRegistry(port.intValue());
      registryCreated = true;
    }
  } catch (ExportException exception) {
    LOG.error("Exception starting RMI registry. Error was " + exception.getMessage(), exception);
  }
}

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

/**
 * Returns a list of bound objects.
 * <p>
 * This should match the list of cachePeers i.e. they should always be bound
 *
 * @return a list of String representations of <code>RMICachePeer</code> objects
 */
protected String[] listBoundRMICachePeers() throws CacheException {
  try {
    return registry.list();
  } catch (RemoteException e) {
    throw new CacheException("Unable to list cache peers " + e.getMessage());
  }
}

代码示例来源:origin: killme2008/xmemcached

try {
 registry = LocateRegistry.getRegistry(port);
 registry.list();
} catch (Exception e) {
 registry = null;
 registry = LocateRegistry.createRegistry(port);
registry.list();
String serverURL = "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/" + rmiName;
JMXServiceURL url = new JMXServiceURL(serverURL);

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

Registry registry = null;
try {
  registry = LocateRegistry.getRegistry(52365);//use any no. less than 55000
  registry.list();
  // This call will throw an exception if the registry does not already exist
}
catch (RemoteException e) { 
  registry = LocateRegistry.createRegistry(52365);
}

代码示例来源:origin: com.github.nyla-solutions/nyla.solutions.core

public String[] list ()
{
 try
  {
    return this.registry.list();
  }

  catch (Exception e)
  {
    return null;
  }
}

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

public class RegistryViewer {
 public static void main(String... args){
  String host = args[0];
  int port = Integer.parseInt(args[1]);
  Registry registry = LocateRegistry.getRegistry(host, port);
  for (String name : registry.list()) {
    System.out.println(name);
  }
 }    
}

代码示例来源:origin: org.apache.geode/gemfire-core

/**
 * Returns an array of the names bound in the rmiregistry
 * 
 * @return an array of the names bound in the rmiregistry
 * @see java.rmi.registry.Registry#list()
 */
public String[] list() throws RemoteException {
 if (!isRunning()) {
  throw new IllegalStateException("RMIRegistryService is not running");
 }
 return registry.list();
}

代码示例来源:origin: com.mchange/mchange-commons-java

public static boolean registryAvailable(int port) throws RemoteException, AccessException
 {
  try
 {
  Registry reg = LocateRegistry.getRegistry(port);
  reg.list(); //just a safe registry call, to see if the registry exists
  return true;
 }
  catch (java.rmi.ConnectException e) //this is what we get if no Registry is exported
 {return false;}
 }

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

/**
 * Returns an array of the names bound in the rmiregistry
 * 
 * @return an array of the names bound in the rmiregistry
 * @see java.rmi.registry.Registry#list()
 */
public String[] list() throws RemoteException {
 if (!isRunning()) {
  throw new IllegalStateException("RMIRegistryService is not running");
 }
 return registry.list();
}

代码示例来源:origin: mx4j/mx4j-tools

public String[] list() throws RemoteException
{
 if (!isRunning()) throw new IllegalStateException("NamingService is not running");
 return m_registry.list();
}

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

@Override
 public void executeImpl(final ConsoleContext context) throws Exception {
  SystemUtils.printToStandardOut("Available services for host ({0}) listening on port ({1}): {2}", 
    context.getHost(), context.getPort(), Arrays.asList(context.getRegistry().list()));
 }
}

相关文章

微信公众号

最新文章

更多