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.");
}