List of usage examples for java.rmi AlreadyBoundException toString
public String toString()
From source file:org.jgentleframework.integration.remoting.rmi.support.RmiExecutor.java
/** * Run service./*from w ww . j ava2 s . co m*/ * * @param rmiExporter * the rmi exporter * @throws RemoteException * the remote exception */ public static void runService(RmiExporter rmiExporter) throws RemoteException { // Chun b khi to rmi service prepareService(rmiExporter); Remote exportedObject = rmiExporter.getExportedObject(); int servicePort = rmiExporter.getServicePort(); String serviceName = rmiExporter.getServiceName(); // Export RMI object bean thnh remote object. if (rmiExporter.getRmiClientSocketFactory() != null) { UnicastRemoteObject.exportObject(exportedObject, servicePort, rmiExporter.getRmiClientSocketFactory(), rmiExporter.getRmiServerSocketFactory()); } else { UnicastRemoteObject.exportObject(exportedObject, servicePort); } // Bind RMI object bean vo registry. try { if (rmiExporter.isReplaceExistingBinding()) { rmiExporter.getRegistry().rebind(serviceName, exportedObject); } else { rmiExporter.getRegistry().bind(serviceName, exportedObject); } } catch (AlreadyBoundException ex) { unexportObjectBeanService(rmiExporter); throw new IllegalStateException( "Already an RMI object bound for name [" + serviceName + "'] :: " + ex.toString()); } catch (RemoteException ex) { unexportObjectBeanService(rmiExporter); throw ex; } if (log.isInfoEnabled()) { log.info("RMI service ['" + serviceName + "'] at service_port [" + servicePort + "], registry_host [" + rmiExporter.getRegistryHost() + "], registry_port [" + rmiExporter.getRegistryPort() + "] is running ... !"); } }