@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); } }
/** * 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); } } } }
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); } }
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); }
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 ); }
throw new ExportException(obj.getClass().getName() + " already exported");
throw new NullPointerException("impl cannot be null"); } else if (!(impl instanceof ActivationSystem)) { throw new ExportException("cannot create dispatcher", new IllegalArgumentException( "impl must be an ActivationSystem"));
throw new NullPointerException("impl cannot be null"); } else if (!(impl instanceof ActivationSystem)) { throw new ExportException("cannot create dispatcher", new IllegalArgumentException( "impl must be an ActivationSystem"));
@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); } }
throw new ExportException(obj.getClass().getName() + " already exported");
throw new NullPointerException("impl cannot be null"); } else if (!(impl instanceof ActivationSystem)) { throw new ExportException("cannot create dispatcher", new IllegalArgumentException( "impl must be an ActivationSystem"));
throw new ExportException(obj.getClass().getName() + " already exported"); } else { logger.error("Tie not found"); throw new ExportException("Tie not found"); } else { logger.error("{0} is not a supported protocol. Use jrmp, iiop or irmi.", protocol); throw new ExportException(protocol+" is not a supported protocol. Use jrmp, iiop or irmi.");
Exporter.class); } catch (ConfigurationException e) {// exception, use default ExportException e1 = new ExportException ("Configuration exception while " + "retrieving exporter for "