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

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

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

Registry.unbind介绍

[英]Removes the binding for the specified name in this registry.
[中]删除此注册表中指定name的绑定。

代码示例

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

/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
  if (logger.isDebugEnabled()) {
    logger.debug("Unbinding RMI service '" + this.serviceName +
        "' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
  }
  try {
    this.registry.unbind(this.serviceName);
  }
  catch (NotBoundException ex) {
    if (logger.isInfoEnabled()) {
      logger.info("RMI service '" + this.serviceName + "' is not bound to registry" +
          (this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
    }
  }
  finally {
    unexportObjectSilently();
  }
}

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

/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
  if (logger.isDebugEnabled()) {
    logger.debug("Unbinding RMI service '" + this.serviceName +
        "' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
  }
  try {
    this.registry.unbind(this.serviceName);
  }
  catch (NotBoundException ex) {
    if (logger.isInfoEnabled()) {
      logger.info("RMI service '" + this.serviceName + "' is not bound to registry" +
          (this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
    }
  }
  finally {
    unexportObjectSilently();
  }
}

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

/**
  * Removes the binding for the specified <code>name</code> in the rmiregistry
  *
  * @see java.rmi.registry.Registry#unbind(String)
  */
 @Override
 public void unbind(String name) throws RemoteException, NotBoundException {
  if (!isRunning()) {
   throw new IllegalStateException("RMIRegistryService is not running");
  }
  registry.unbind(name);
 }
}

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

/**
 * <p>
 * Un-bind the scheduler from an RMI registry.
 * </p>
 */
private void unBind() throws RemoteException {
  String host = resources.getRMIRegistryHost();
  // don't un-export if we're not configured to do so...
  if (host == null || host.length() == 0) {
    return;
  }
  Registry registry = LocateRegistry.getRegistry(resources
      .getRMIRegistryHost(), resources.getRMIRegistryPort());
  String bindName = resources.getRMIBindName();
  
  try {
    registry.unbind(bindName);
    UnicastRemoteObject.unexportObject(this, true);
  } catch (java.rmi.NotBoundException nbe) {
  }
  getLog().info("Scheduler un-bound from name '" + bindName + "' in RMI registry");
}

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

/**
 * <p>
 * Un-bind the scheduler from an RMI registry.
 * </p>
 */
private void unBind() throws RemoteException {
  String host = resources.getRMIRegistryHost();
  // don't un-export if we're not configured to do so...
  if (host == null || host.length() == 0) {
    return;
  }
  Registry registry = LocateRegistry.getRegistry(resources
      .getRMIRegistryHost(), resources.getRMIRegistryPort());
  String bindName = resources.getRMIBindName();
  
  try {
    registry.unbind(bindName);
    UnicastRemoteObject.unexportObject(this, true);
  } catch (java.rmi.NotBoundException nbe) {
  }
  getLog().info("Scheduler un-bound from name '" + bindName + "' in RMI registry");
}

代码示例来源:origin: org.jboss.byteman/byteman-dtest

/**
 * Remove the local communication endpoint for the given class.
 *
 * @param className the class to remove.
 * @throws Exception in case of failure.
 */
private void unpublish(String className) throws Exception
{
  registry.unbind(className);
}

代码示例来源:origin: uk.org.taverna.server/server-worker

static synchronized void unregisterFactory() {
  if (!shuttingDown) {
    shuttingDown = true;
    try {
      if (factoryName != null && registry != null)
        registry.unbind(factoryName);
    } catch (Exception e) {
      e.printStackTrace(out);
    }
  }
}

代码示例来源:origin: org.apache.taverna.server/taverna-server-worker

static synchronized void unregisterFactory() {
  if (!shuttingDown) {
    shuttingDown = true;
    try {
      if (factoryName != null && registry != null)
        registry.unbind(factoryName);
    } catch (Exception e) {
      e.printStackTrace(out);
    }
  }
}

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

public void unbind(String name) throws RemoteException, NotBoundException
  {
   if (!isRunning()) throw new IllegalStateException("NamingService is not running");
   m_registry.unbind(name);
  }
}

代码示例来源:origin: groupon/odo

public void stopServer() {
    try {
      registry.unbind(SERVICE_NAME);
      UnicastRemoteObject.unexportObject(registry, true);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

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

/**
  * Removes the binding for the specified <code>name</code> in the rmiregistry
  * 
  * @see java.rmi.registry.Registry#unbind(String)
  */
 public void unbind(String name) throws RemoteException, NotBoundException {
  if (!isRunning()) {
   throw new IllegalStateException("RMIRegistryService is not running");
  }
  registry.unbind(name);
 }
}

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

/**
  * Removes the binding for the specified <code>name</code> in the rmiregistry
  * 
  * @see java.rmi.registry.Registry#unbind(String)
  */
 public void unbind(String name) throws RemoteException, NotBoundException {
  if (!isRunning()) {
   throw new IllegalStateException("RMIRegistryService is not running");
  }
  registry.unbind(name);
 }
}

代码示例来源:origin: org.mobicents.servers.jainslee.core/remote

private boolean deregister() {
  try {
    registry.unbind("RemoteSleeConnectionService");
    return UnicastRemoteObject.unexportObject(registry, false);
  } catch (RemoteException e) {
    throw new RuntimeException("Failed to unbind due to", e);
  } catch (NotBoundException e) {
    throw new RuntimeException("Failed to unbind due to", e);
  }
}

代码示例来源:origin: org.mobicents.tools/heartbeat-rmi

@Override
public void stopServer() {
  try {
    registry.unbind("SIPBalancer");
    UnicastRemoteObject.unexportObject(registry, false);
  } catch (RemoteException e) {
    throw new RuntimeException("Failed to unbind due to", e);
  } catch (NotBoundException e) {
    throw new RuntimeException("Failed to unbind due to", e);
  }
}

代码示例来源:origin: de.sfb876/streams-runtime

/**
 * @see stream.service.NamingService#unregister(java.lang.String)
 */
@Override
public void unregister(String ref) throws Exception {
  String localRef = getLocalRef(ref);
  if (localRef == null)
    throw new Exception("Cannot resolve reference '" + ref + "' as local reference!");
  log.debug("Service {} unregistered.", ref);
  registry.unbind(localRef);
  classes.remove(localRef);
  log.debug("After un-registration, classes are: {}", classes);
}

代码示例来源:origin: com.kohlschutter.junixsocket/junixsocket-rmi

public void unbind(String name) throws RemoteException, NotBoundException,
  java.net.MalformedURLException {
 getRegistry().unbind(name);
}

代码示例来源:origin: org.jwall/stream-runtime

/**
 * @see stream.service.NamingService#unregister(java.lang.String)
 */
@Override
public void unregister(String ref) throws Exception {
  String localRef = getLocalRef(ref);
  if (localRef == null)
    throw new Exception("Cannot resolve reference '" + ref
        + "' as local reference!");
  log.debug("Service {} unregistered.", ref);
  registry.unbind(localRef);
  classes.remove(localRef);
  log.debug("After un-registration, classes are: {}", classes);
}

代码示例来源:origin: org.apache.oodt/oodt-commons

public void unbind(String name) throws NamingException {
  checkName(name);
  Registry registry = getRegistry();
  try {
    registry.unbind(toRMIName(name));
  } catch (NotBoundException ex) {
    throw new NameNotFoundException(name + " not found in RMI registry " + registry);
  } catch (RemoteException ex) {
    throw new NamingException("Remote exception: " + ex.getMessage());
  }
}

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

public void unbind(String name) throws NamingException {
  checkName(name);
  Registry registry = getRegistry();
  try {
    registry.unbind(toRMIName(name));
  } catch (NotBoundException ex) {
    throw new NameNotFoundException(name + " not found in RMI registry " + registry);
  } catch (RemoteException ex) {
    throw new NamingException("Remote exception: " + ex.getMessage());
  }
}

代码示例来源:origin: org.apache.camel/camel-rmi

@Override
protected void doStop() throws Exception {
  super.doStop();
  try {
    Registry registry = endpoint.getRegistry();
    registry.unbind(endpoint.getName());
  } catch (Throwable e) {
    // do our best to unregister
  }
  UnicastRemoteObject.unexportObject(proxy, true);
}

相关文章

微信公众号

最新文章

更多