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

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

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

Naming.unbind介绍

暂无

代码示例

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

String url = rmiCachePeer.getUrl();
try {
  Naming.unbind(url);
} catch (NotBoundException e) {
  LOG.warn(url + " not bound therefore not unbinding.");

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

/**
 * Cleans up after this test by unbinding the instance of
 * <code>RemoteBlockingQueue</code> that was initialized in {@link
 * #setUp}.
 */
public void tearDown2() throws Exception {
 Naming.unbind(this.queueURL);
}

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

public void stopServer(int port) throws RemoteException {
  try {
    Naming.unbind("rmi://localhost:" + port + "/RmiDatabaseServer");
    UnicastRemoteObject.unexportObject(reg,true);
  } catch (Exception e) {
    LOG.log(Level.SEVERE, e.getMessage());
    throw new RemoteException(
        "Unable to unbind Database Server: reason: "
            + e.getMessage());
  }
}

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

public void stopServer(int port) throws RemoteException {
  try {
    Naming.unbind("rmi://localhost:" + port + "/RmiDatabaseServer");
    UnicastRemoteObject.unexportObject(reg,true);
  } catch (Exception e) {
    LOG.log(Level.SEVERE, e.getMessage());
    throw new RemoteException(
        "Unable to unbind Database Server: reason: "
            + e.getMessage());
  }
}

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

/**
 * Unbinds the repository from RMI.
 */
public void destroy() {
  try {
    Naming.unbind(url);
  } catch (NotBoundException e) {
    // Ignore, perhaps the reference was already manually removed
  } catch (MalformedURLException e) {
    // Ignore, we already logged a warning about this during init()
  } catch (RemoteException e) {
    log("Failed to unbind repository from RMI: " + url, e);
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-servlet

/**
 * Unbinds the repository from RMI.
 */
public void destroy() {
  try {
    Naming.unbind(url);
  } catch (NotBoundException e) {
    // Ignore, perhaps the reference was already manually removed
  } catch (MalformedURLException e) {
    // Ignore, we already logged a warning about this during init()
  } catch (RemoteException e) {
    log("Failed to unbind repository from RMI: " + url, e);
  }
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

public static boolean  unbindService(String serviceaddress)
{
  try {
    RMIUtil.setEnv();
    Naming.unbind(serviceaddress);
    return true;
  } catch (RemoteException e) {
    log.error("serviceaddress="+serviceaddress,e);
  } catch (MalformedURLException e) {
    log.error("serviceaddress="+serviceaddress,e);
  } catch (NotBoundException e) {
    log.error("serviceaddress="+serviceaddress,e);
  }
  catch (Exception e) {
    log.error("serviceaddress="+serviceaddress,e);
  }
  return false;
}

代码示例来源:origin: com.caucho/resin

log.fine(L.l("unbinding rmi name `{0}'", _boundName));
Naming.unbind(_boundName);

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

public static String close(final Service svc)
throws RemoteException, MalformedURLException {
  final String svcName = svc.getName();
  String svcUri = null;
  try {
    UnicastRemoteObject.unexportObject(svc, true);
  } finally {
    try {
      svcUri = getLocalSvcUri(svcName, svc.getRegistryPort()).toString();
      Naming.unbind(svcUri);
      synchronized(SVC_MAP) {
        if(null == SVC_MAP.remove(svcName + ":" + svc.getRegistryPort())) {
          System.err.println(
            "Failed to remove the service \"" + svcName + "\""
          );
        }
      }
    } catch(final NotBoundException | URISyntaxException e) {
      e.printStackTrace(System.err);
    }
  }
  return svcUri;
}

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

@Override
public void shutdown() throws RemoteException, MalformedURLException, NotBoundException {
  // System.out.println("ProcessEngine shutdown : désactivation du service en cours.");
  getLogger().info("ProcessEngine désactivation du service en cours.");
  Naming.unbind(getRemoteBindName());
  if (channelslots != null && channelslots.size() > 0) {
    for (String key : channelslots.keySet()) {
      ChannelSlot channelSlot = channelslots.get(key);
      if (!channelSlot.isPlugged() && channelSlot.getBufferedMessageCount() > 0) {
        int cpt = 1;
        for (Object msg : channelSlot.getBufferedMessage()) {
          channelSlot.storeBufferedMessage(errorPath.getAbsolutePath() + "/" + channelSlot.getName(), msg, cpt);
          cpt++;
        }
      }
    }
  }
  UnicastRemoteObject.unexportObject(remoteMsgHandler, true);
  getLogger().info("ProcessEngine shutdown");
}

代码示例来源:origin: emc-mongoose/mongoose

public static String close(final Service svc) throws RemoteException, MalformedURLException {
 final String svcName = svc.name();
 String svcUri = null;
 try {
  UnicastRemoteObject.unexportObject(svc, true);
 } finally {
  try {
   svcUri = getLocalSvcUri(svcName, svc.registryPort()).toString();
   Naming.unbind(svcUri);
   synchronized (SVC_MAP) {
    if (null == SVC_MAP.remove(svcName + ":" + svc.registryPort())) {
     System.err.println("Failed to remove the service \"" + svcName + "\"");
    }
   }
  } catch (final NotBoundException | URISyntaxException | SocketException e) {
   LogUtil.trace(Loggers.ERR, Level.WARN, e, "Failed to close the RMI service");
  }
 }
 return svcUri;
}

代码示例来源:origin: com.synaptix/processmanager-core

public void shutdown() throws RemoteException, MalformedURLException,
    NotBoundException {
  // System.out.println("ProcessEngine shutdown : désactivation du service en cours.");
  getLogger().info(
      "ProcessEngine désactivation du service en cours.");
  Naming.unbind(getRemoteBindName());
  if(channelslots!=null && channelslots.size()>0){
    for(String key:channelslots.keySet()){
      ChannelSlot channelSlot = channelslots.get(key);
      if(!channelSlot.isPlugged()&&channelSlot.getBufferedMessageCount()>0){
        int cpt=1;
        for(Object msg:channelSlot.getBufferedMessage()){
          channelSlot.storeBufferedMessage(errorPath.getAbsolutePath()+"/"+channelSlot.getName(), msg, cpt);
          cpt++;
        }
      }
    }
  }
  UnicastRemoteObject.unexportObject(remoteMsgHandler, true);
  getLogger().info(
  "ProcessEngine shutdown");
}

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

String url = rmiCachePeer.getUrl();
try {
  Naming.unbind(url);
} catch (NotBoundException e) {
  LOG.warn(url + " not bound therefore not unbinding.");

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webapp

/**
 * Unregisters the repository from the RMI registry, if it has previously
 * been registered.
 */
private void unregisterRMI() {
  if (rmiRepository != null) {
    // Forcibly unexport the repository;
    try {
      UnicastRemoteObject.unexportObject(rmiRepository, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI repository was not exported", e);
    }
    // drop strong reference to remote repository
    rmiRepository = null;
    // unregister repository
    try {
      Naming.unbind(config.getRmiConfig().getRmiUri());
    } catch (Exception e) {
      log("Error while unbinding repository from JNDI: " + e);
    }
  }
  if (rmiRegistry != null) {
    try {
      UnicastRemoteObject.unexportObject(rmiRegistry, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI registry was not exported", e);
    }
    rmiRegistry = null;
  }
}

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

/**
 * Unregisters the repository from the RMI registry, if it has previously
 * been registered.
 */
private void unregisterRMI() {
  if (rmiRepository != null) {
    // Forcibly unexport the repository;
    try {
      UnicastRemoteObject.unexportObject(rmiRepository, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI repository was not exported", e);
    }
    // drop strong reference to remote repository
    rmiRepository = null;
    // unregister repository
    try {
      Naming.unbind(config.getRmiConfig().getRmiUri());
    } catch (Exception e) {
      log("Error while unbinding repository from JNDI: " + e);
    }
  }
  if (rmiRegistry != null) {
    try {
      UnicastRemoteObject.unexportObject(rmiRegistry, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI registry was not exported", e);
    }
    rmiRegistry = null;
  }
}

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

/**
 * Unregisters the repository from the RMI registry, if it has previously
 * been registered.
 */
private void unregisterRMI() {
  if (rmiRepository != null) {
    // Forcibly unexport the repository;
    try {
      UnicastRemoteObject.unexportObject(rmiRepository, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI repository was not exported", e);
    }
    // drop strong reference to remote repository
    rmiRepository = null;
    // unregister repository
    try {
      Naming.unbind(config.getRmiConfig().getRmiUri());
    } catch (Exception e) {
      log("Error while unbinding repository from JNDI: " + e);
    }
  }
  if (rmiRegistry != null) {
    try {
      UnicastRemoteObject.unexportObject(rmiRegistry, true);
    } catch (NoSuchObjectException e) {
      log.warn("Odd, the RMI registry was not exported", e);
    }
    rmiRegistry = null;
  }
}

代码示例来源:origin: org.tentackle/tentackle-database

/**
 * Stops the server.
 * <p>
 * Unbinds the connection object.
 */
public void stop() {
 try {
  if (connectionObject != null) {
   connectionObject.unexportRemoteObject(connectionObject);
   connectionObject = null;
  }
  if (registry != null) {
   // unbind all services registered for local registry
   for (String name: registry.list()) {
    LOGGER.info("unbinding {0}", name);
    registry.unbind(name);
   }
   UnicastRemoteObject.unexportObject(registry, true);
   registry = null;
  }
  else {
   LOGGER.info("unbinding {0}", service);
   Naming.unbind(service);
  }
 }
 catch (MalformedURLException | NotBoundException | RemoteException e) {
  throw new TentackleRuntimeException("server shutdown failed", e);
 }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

if (namingServiceType == REGISTRY_NAMING_SERVICE) {
  unbindName = formatURLforRegistry(rcm.getServiceId().getURL(), rcm.getServiceId().getId());
  Naming.unbind(unbindName);
} else if (namingServiceType == JNDI_NAMING_SERVICE) {
  unbindName = rcm.getServiceId().getId();

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

if (namingServiceType == REGISTRY_NAMING_SERVICE) {
  unbindName = formatURLforRegistry(rcm.getServiceId().getURL(), rcm.getServiceId().getId());
  Naming.unbind(unbindName);
} else if (namingServiceType == JNDI_NAMING_SERVICE) {
  unbindName = rcm.getServiceId().getId();

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

if (namingServiceType == REGISTRY_NAMING_SERVICE) {
  unbindName = formatURLforRegistry(rcm.getServiceId().getURL(), rcm.getServiceId().getId());
  Naming.unbind(unbindName);
} else if (namingServiceType == JNDI_NAMING_SERVICE) {
  unbindName = rcm.getServiceId().getId();

相关文章