@Override public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException { try { BittrexMarketSummary summary = getBittrexMarketSummary(BittrexUtils.toPairString(currencyPair)); if (summary == null) { throw new ExportException("Bittrex didn't return any summary nor an error"); } return BittrexAdapters.adaptTicker(summary, currencyPair); } catch (BittrexException e) { throw BittrexErrorAdapter.adapt(e); } }
/** * Start the rmiregistry. * <p> * The alternative is to use the <code>rmiregistry</code> binary, in which case: * <ol> * <li>rmiregistry running * <li>-Djava.rmi.server.codebase="file:///Users/gluck/work/ehcache/build/classes/ file:///Users/gluck/work/ehcache/lib/commons-logging-1.0.4.jar" * </ol> * * @throws RemoteException */ protected void startRegistry() throws RemoteException { try { registry = LocateRegistry.getRegistry(port.intValue()); try { registry.list(); } catch (RemoteException e) { //may not be created. Let's create it. registry = LocateRegistry.createRegistry(port.intValue()); registryCreated = true; } } catch (ExportException exception) { LOG.error("Exception starting RMI registry. Error was " + exception.getMessage(), exception); } }
@Override public void preStart() throws ManagementException { int port = getMinPort(); if (getMaxPort() == -1) { try { registry = LocateRegistry.createRegistry(minPort); assignedPort = minPort; } catch (RemoteException ex) { throw new ManagementException(ex); } } else { assignedPort = minPort; while (port <= getMaxPort()) { try { registry = LocateRegistry.createRegistry(assignedPort); return; } catch (ExportException ex) { if (ex.getCause() instanceof BindException) { ++assignedPort; continue; } throw new ManagementException(ex); } catch (RemoteException ex) { throw new ManagementException(ex); } } } }
/** * Corresponds to <code>GET /fills</code> * * @return * @throws IOException */ public AbucoinsFills getAbucoinsFills(String afterCursor, Integer limit) throws IOException { try { AbucoinsFills fills = abucoinsAuthenticated.getFills( exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getExchangeSpecification().getPassword(), timestamp(), afterCursor, limit); return fills; } catch (HttpStatusIOException initialException) { // in case of error Abucoins returns HTTP status 200 with a single property JSON try { AbucoinsError error = ObjectMapperHelper.readValue(initialException.getHttpBody(), AbucoinsError.class); throw new ExchangeException(error.getMessage()); } catch (IOException finalException) { throw new ExportException( "Response neither expected DTO nor error message", finalException); } } } }
/** * Start the rmiregistry. * <p> * The alternative is to use the <code>rmiregistry</code> binary, in which case: * <ol> * <li>rmiregistry running * <li>-Djava.rmi.server.codebase="file:///Users/gluck/work/ehcache/build/classes/ file:///Users/gluck/work/ehcache/lib/commons-logging-1.0.4.jar" * </ol> * * @throws RemoteException */ protected void startRegistry() throws RemoteException { try { registry = LocateRegistry.getRegistry(port.intValue()); try { registry.list(); } catch (RemoteException e) { //may not be created. Let's create it. registry = LocateRegistry.createRegistry(port.intValue()); registryCreated = true; } } catch (ExportException exception) { LOG.error("Exception starting RMI registry. Error was " + exception.getMessage(), exception); } }
public synchronized Remote export(Remote impl) throws ExportException { this.impl = impl; try { return RemoteObject.toStub(impl); } catch (NoSuchObjectException e) { throw new ExportException("no stub found", e); } }
/** * Start the rmiregistry. * <p/> * The alternative is to use the <code>rmiregistry</code> binary, in which case: * <ol/> * <li>rmiregistry running * <li>-Djava.rmi.server.codebase="file:///Users/gluck/work/ehcache/build/classes/ file:///Users/gluck/work/ehcache/lib/commons-logging-1.0.4.jar" * </ol> * * @throws RemoteException */ protected void startRegistry() throws RemoteException { try { registry = LocateRegistry.getRegistry(port.intValue()); try { registry.list(); } catch (RemoteException e) { //may not be created. Let's create it. registry = LocateRegistry.createRegistry(port.intValue()); registryCreated = true; } } catch (ExportException exception) { LOG.error("Exception starting RMI registry. Error was " + exception.getMessage(), exception); } }
protected static Remote exportObject(Remote obj, String refClassName, Class[] params, Object[] args) throws RemoteException { Class refClass; try { refClass = Class.forName(refClassName); } catch (ClassNotFoundException e) { throw new ExportException("Class " + refClassName + " not found"); } if (!ServerRef.class.isAssignableFrom(refClass)) { throw new ExportException("Class " + refClassName + " not instance of " + ServerRef.class.getName()); } // create server ref instance using given constructor and arguments ServerRef serverRef; try { java.lang.reflect.Constructor cons = refClass.getConstructor(params); serverRef = (ServerRef) cons.newInstance(args); // if impl does extends JUnicastRemoteObject set its ref if (obj instanceof JUnicastRemoteObject) ((JUnicastRemoteObject) obj).ref = serverRef; } catch (Exception e) { throw new ExportException("Exception creating instance of " + refClassName, e); } return serverRef.exportObject(obj, null); }
/** * Start the rmiregistry. * <p/> * The alternative is to use the <code>rmiregistry</code> binary, in which case: * <ol/> * <li>rmiregistry running * <li>-Djava.rmi.server.codebase="file:///Users/gluck/work/ehcache/build/classes/ file:///Users/gluck/work/ehcache/lib/commons-logging-1.0.4.jar" * </ol> * * @throws RemoteException */ protected void startRegistry() throws RemoteException { try { registry = LocateRegistry.getRegistry(port.intValue()); try { registry.list(); } catch (RemoteException e) { //may not be created. Let's create it. registry = LocateRegistry.createRegistry(port.intValue()); registryCreated = true; } } catch (ExportException exception) { LOG.error("Exception starting RMI registry. Error was " + exception.getMessage(), exception); } }
refClass = Class.forName( refClassName ); } catch ( ClassNotFoundException e ) { throw new ExportException( "No class found for server ref type: " + refType ); throw new ExportException( "Server ref class not instance of " + ServerRef.class.getName() + ": " + refClass.getName() ); ((UnicastRemoteObject)obj).ref = serverRef; } catch ( Exception e ) { throw new ExportException( "Exception creating instance of server ref class: " + refClass.getName(), e );
/** * Return the Tie object for an RMI object. * @param obj The RMI object. * @return The Tie object * @throws java.rmi.server.ExportException */ private Tie toTie(java.rmi.Remote obj) throws java.rmi.server.ExportException { for (Class clz = obj.getClass(); clz != null; clz = clz.getSuperclass()) { try { final String tieClzName = newRMIClassName(clz.getName(), "Tie"); return newTie(tieClzName, clz); } catch (ClassNotFoundException e) { // throw new java.rmi.server.ExportException("ClassNotFoundException: ", e ); } catch (InstantiationException e) { throw new java.rmi.server.ExportException("InstantiationException: ", e); } catch (IllegalAccessException e) { throw new java.rmi.server.ExportException("IllegalAccessException: ", e); } } throw new java.rmi.server.ExportException("Tie class not found "); }
throw new ExportException( "proxy implements non-public interface");
throw (ExportException) t; } else if (t instanceof RemoteException) { throw new ExportException("export failed", (Exception) t); } else if (t instanceof RuntimeException) { throw (RuntimeException) t;
throw ex; } catch (RemoteException ex) { throw new ExportException("export failed", ex);
} else if (getTieClass(impl.getClass()) == null) { throw new ExportException("tie class unavailable"); throw ex; } catch (RemoteException ex) { throw new ExportException("export failed", ex);
/** * Makes a server object ready to receive remote calls. Note * that subclasses of PortableRemoteObject do not need to call this * method, as it is called by the constructor. * @param obj the server object to export. * @exception RemoteException if export fails. */ public void exportObject(Remote obj) throws RemoteException { if (obj == null) { throw new NullPointerException("invalid argument"); } // Has this object already been exported to IIOP? if (Util.getTie(obj) != null) { // Yes, so this is an error... throw new ExportException (obj.getClass().getName() + " already exported"); } // Can we load a Tie? Tie theTie = Utility.loadTie(obj); if (theTie != null) { // Yes, so export it to IIOP... Util.registerTarget(theTie,obj); } else { // No, so export to JRMP. If this is called twice for the // same object, it will throw an ExportException... UnicastRemoteObject.exportObject(obj); } }
/** * Export an RMI object as a CORBA object * @see javax.rmi.CORBA.PortableRemoteObjectDelegate#exportObject(java.rmi.Remote) */ public void exportObject( java.rmi.Remote obj ) throws java.rmi.RemoteException { if (obj == null) { throw new IllegalArgumentException(); } if ( obj instanceof Stub ) { throw new java.rmi.server.ExportException( "Attempted to export a stub class" ); } Tie tie = Util.getTie( obj ); if ( tie != null ) { throw new java.rmi.server.ExportException( "Object already exported" ); } tie = toTie( obj ); tie.orb( getORB() ); Util.registerTarget( tie, obj ); }
try { if (!(main instanceof RemoteMethodControl)) { throw new ExportException( "main proxy must implement RemoteMethodControl"); } else if (!(main instanceof TrustEquivalence)) { throw new ExportException( "main proxy must implement TrustEquivalence"); for (int i = ifs.length; --i >= 0; ) { if (needPub && !Modifier.isPublic(ifs[i].getModifiers())) { throw new ExportException( "main proxy implements non-public interface"); throw new ExportException( "bootstrap proxy must implement ProxyTrust"); } else if (!(boot instanceof RemoteMethodControl)) { throw new ExportException( "bootstrap proxy must implement RemoteMethodControl"); } else if (!(boot instanceof TrustEquivalence)) { throw new ExportException( "bootstrap proxy must implement TrustEquivalence"); return proxy; } catch (IllegalArgumentException e) { throw new ExportException("export failed", e); } finally { if (!ok) {
try { if (!(main instanceof RemoteMethodControl)) { throw new ExportException( "main proxy must implement RemoteMethodControl"); } else if (!(main instanceof TrustEquivalence)) { throw new ExportException( "main proxy must implement TrustEquivalence"); for (int i = ifs.length; --i >= 0; ) { if (needPub && !Modifier.isPublic(ifs[i].getModifiers())) { throw new ExportException( "main proxy implements non-public interface"); throw new ExportException( "bootstrap proxy must implement ProxyTrust"); } else if (!(boot instanceof RemoteMethodControl)) { throw new ExportException( "bootstrap proxy must implement RemoteMethodControl"); } else if (!(boot instanceof TrustEquivalence)) { throw new ExportException( "bootstrap proxy must implement TrustEquivalence"); return proxy; } catch (IllegalArgumentException e) { throw new ExportException("export failed", e); } finally { if (!ok) {
throw new ExportException(obj.getClass().getName() + " already exported");