private Exception convertException(Throwable e) { if (e instanceof IOException) { if (watchedObjectContext.requestWatchHasException()) return new ConnectIOException(e.getMessage(), watchedObjectContext.getAndClearRequestWatchException()); if (watchedObjectContext.responseWatchHasException()) return new ConnectIOException(e.getMessage(), watchedObjectContext.getAndClearResponseWatchException()); return new ConnectException(e.getMessage(), (Exception) e); } if (e instanceof MarshalContextClearedException) return new RemoteException(e.getMessage(), e); if (e instanceof Exception) return (Exception) e; return new ExecutionException(e); }
public static void initializeRegistry(String serverAddress, String serverPort) throws RemoteException, NotBoundException, NoRouteToHostException, ConnectIOException { if (initialized) { return; } int port = (new Integer(serverPort)).intValue(); Registry registry; LOG.debug("Connecting to MedSavantServerEngine @ " + serverAddress + ":" + serverPort + "..."); try { registry = LocateRegistry.getRegistry(serverAddress, port, new SslRMIClientSocketFactory()); LOG.debug("Retrieving adapters..."); setAdaptersFromRegistry(registry); LOG.info("Connected with SSL/TLS Encryption"); } catch (ConnectIOException ex) { if (ex.getCause() instanceof SSLHandshakeException) { registry = LocateRegistry.getRegistry(serverAddress, port); LOG.debug("Retrieving adapters..."); setAdaptersFromRegistry(registry); LOG.info("Connected without SSL/TLS encryption"); } } LOG.debug("Done"); }
throw new ConnectException("activation failed", e); } catch (RemoteException e) { throw new ConnectIOException("activation failed", e); } catch (UnknownObjectException e) { throw new NoSuchObjectException("object not registered");
throw new ConnectIOException(exMessage, _watchdogContext.getAndClearRequestWatchException()); throw new ConnectIOException(exMessage, _watchdogContext.getAndClearResponseWatchException());