List of usage examples for java.rmi Remote toString
public String toString()
From source file:org.globus.workspace.remoting.admin.client.RMIConfig.java
protected Remote setupRemoting() throws ExecutionProblem { final RemotingClient client = new RemotingClient(); client.setSocketDirectory(this.socketDirectory); try {//from w w w . ja va2 s.co m client.initialize(); } catch (RemoteException e) { handleRemoteException(e); } try { final Remote remote = client.lookup(this.bindingName); logger.debug("Found remote object " + remote.toString()); return remote; } catch (RemoteException e) { handleRemoteException(e); return null; } catch (NotBoundException e) { throw new ExecutionProblem("Failed to bind to object '" + this.bindingName + "'. There may be a configuration problem between the " + "client and service. Error: " + e.getMessage(), e); } }
From source file:org.globus.workspace.remoting.RemotingServer.java
public void initialize() throws RemoteException, AlreadyBoundException { if (this.socketDirectory == null) { throw new IllegalStateException("socketDirectory must be specified"); }/*from ww w . jav a 2 s. c om*/ if (!this.socketDirectory.isDirectory()) { throw new IllegalStateException( "socketDirectory must be an existing directory: " + this.socketDirectory.getAbsolutePath()); } if (this.bindings == null || this.bindings.isEmpty()) { throw new IllegalStateException("at least one binding must be specified"); } final AFUNIXNaming naming = AFUNIXNaming.getInstance(this.socketDirectory); logger.debug("Socket directory: " + naming.getSocketFactory().getSocketDir()); // this trick allows repeated initializations within the same JVM. (like during test runs) Registry registry; try { registry = naming.createRegistry(); } catch (RemoteException e) { registry = naming.getRegistry(); } final StringBuilder logMessage = new StringBuilder(); logMessage.append("Nimbus remoting server listening on domain socket: \"") .append(this.socketDirectory.getAbsolutePath()).append("\". Bindings:"); boolean first = true; for (final String bindingName : bindings.keySet()) { final Remote obj = bindings.get(bindingName); if (obj == null) { throw new IllegalStateException("Binding object " + bindingName + "' is null"); } logger.debug("Binding " + obj.toString() + " to name '" + bindingName + "'"); final Remote remote = UnicastRemoteObject.exportObject(obj, 0, naming.getSocketFactory(), naming.getSocketFactory()); try { registry.bind(bindingName, remote); } catch (AlreadyBoundException e) { logger.warn("RMI binding '" + bindingName + "' is already bound. Proceeding."); } if (first) { first = false; } else { logMessage.append(","); } logMessage.append(" ").append(bindingName).append(" (").append(obj.getClass().getCanonicalName()) .append(")"); } logger.info(logMessage.toString()); }