List of usage examples for java.math BigInteger ZERO
BigInteger ZERO
To view the source code for java.math BigInteger ZERO.
Click Source Link
From source file:org.mule.module.extension.internal.capability.xml.schema.SchemaBuilder.java
private GroupRef generateNestedProcessorGroup(Parameter parameter, String maxOccurs) { QName ref = MULE_MESSAGE_PROCESSOR_OR_OUTBOUND_ENDPOINT_TYPE; TypeRestrictionCapability restrictionCapability = getSingleCapability(parameter, TypeRestrictionCapability.class); if (restrictionCapability != null) { ref = getSubstitutionGroup(restrictionCapability.getType()); ref = new QName(ref.getNamespaceURI(), getGroupName(ref.getLocalPart()), ref.getPrefix()); }/* w w w . j av a 2s . c o m*/ GroupRef group = new GroupRef(); group.setRef(ref); group.setMinOccurs(parameter.isRequired() ? BigInteger.ONE : BigInteger.ZERO); group.setMaxOccurs(maxOccurs); return group; }
From source file:com.flexive.core.storage.genericSQL.GenericTreeStorageSpreaded.java
/** * Helper function to create a new node. * * @param con an open and valid connection * @param seq reference to a sequencer * @param ce reference to the content engine * @param mode Live or Edit mode * @param parentNodeId the parent node (1=root) * @param name the name of the new node (only informative value) * @param label label for Caption property (only used if new reference is created) * @param position the position within the childs (0 based, Integer.MAX_VALUE may be used to * append to the end) * @param reference a reference to an existing content (must exist!) * @param data the optional data * @param nodeId the id to use or create a new one if < 0 * @param activateContent change the step of contents that have no live step to live in the max version? * @return the used or created node id//from w w w. j a va 2 s . c om * @throws FxTreeException if the function fails */ private long _createNode(Connection con, SequencerEngine seq, ContentEngine ce, FxTreeMode mode, long parentNodeId, String name, FxString label, int position, FxPK reference, String data, long nodeId, boolean activateContent) throws FxApplicationException { // acquire exclusive lock for parent node acquireLocksForUpdate(con, mode, Arrays.asList(parentNodeId)); // makeSpace(con, seq/*irrelevant*/, mode, parentNodeId, position/*irrelevant*/, 1); FxTreeNodeInfoSpreaded parentNode = (FxTreeNodeInfoSpreaded) getTreeNodeInfo(con, mode, parentNodeId); BigInteger boundaries[] = getBoundaries(con, parentNode, position); BigInteger leftBoundary = boundaries[0]; //== left border BigInteger rightBoundary = boundaries[1]; //== right border // Node has to be inserted between the left and right boundary and needs 2 slots for its left and right border BigInteger spacing = rightBoundary.subtract(leftBoundary).subtract(TWO); // Compute spacing for left,inner and right part spacing = spacing.divide(THREE); // We need at least 2 open slots (for the left and right boundary of the new node) //if the spacing is <= 0 we need more space if (spacing.compareTo(BigInteger.ZERO) <= 0/*less than*/) { throw new FxTreeException("ex.tree.create.noSpace", parentNodeId); } // try to use space more efficiently for flat structures, otherwise the first node of a folder // will get a third of the subtree space, the second one ninth, and so on. // Maxspacing indicates the number of nodes (*2) we expect to put in this node before space reorg spacing = spacing.compareTo(DEFAULT_NODE_SPACING) > 0 ? DEFAULT_NODE_SPACING : spacing; // final BigInteger left = leftBoundary.add(spacing).add(BigInteger.ONE); // don't add gap to left boundary (doesn't seem to have any benefits since that space is lost // unless the tree is reorganized anyway final BigInteger left = leftBoundary.add(BigInteger.ONE); final BigInteger right = left.add(spacing).add(BigInteger.ONE); NodeCreateInfo nci = getNodeCreateInfo(mode, seq, ce, nodeId, name, label, reference, activateContent); // Create the node PreparedStatement ps = null; try { ps = con.prepareStatement("INSERT INTO " + getTable(mode) + " (ID,PARENT,DEPTH,DIRTY,REF,LFT,RGT," + "CHILDCOUNT,NAME,MODIFIED_AT,TEMPLATE) VALUES " + "(" + nci.id + "," + parentNodeId + "," + (parentNode.getDepth() + 1) + ",?," + nci.reference.getId() + ",?,?,0,?," + StorageManager.getTimestampFunction() + ",?)"); ps.setBoolean(1, mode != FxTreeMode.Live); setNodeBounds(ps, 2, left); setNodeBounds(ps, 3, right); ps.setString(4, FxFormatUtils.escapeTreePath(nci.name)); if (StringUtils.isEmpty(data)) { ps.setNull(5, java.sql.Types.VARCHAR); } else { ps.setString(6, data); } ps.executeUpdate(); ps.close(); //update the parents childcount ps = con.prepareStatement( "UPDATE " + getTable(mode) + " SET CHILDCOUNT=CHILDCOUNT+1 WHERE ID=" + parentNodeId); ps.executeUpdate(); } catch (SQLException e) { throw new FxTreeException(LOG, e, "ex.db.sqlError", e.getMessage()); } finally { try { if (ps != null) ps.close(); } catch (Throwable t) { /*ignore*/ } } return nci.id; }
From source file:com.hamradiocoin.wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (intent != null) { log.info("service start command: " + intent + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT) ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")" : "")); final String action = intent.getAction(); if (ACTION_CANCEL_COINS_RECEIVED.equals(action)) { notificationCount = 0;/*from w w w. j a v a 2 s . c om*/ notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } else if (ACTION_RESET_BLOCKCHAIN.equals(action)) { log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; stopSelf(); } else if (ACTION_BROADCAST_TRANSACTION.equals(action)) { final Sha256Hash hash = new Sha256Hash(intent.getByteArrayExtra(ACTION_BROADCAST_TRANSACTION_HASH)); final Transaction tx = application.getWallet().getTransaction(hash); if (peerGroup != null) { log.info("broadcasting transaction " + tx.getHashAsString()); peerGroup.broadcastTransaction(tx); } else { log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString()); } } } else { log.warn("service restart, although it was started as non-sticky"); } return START_NOT_STICKY; }
From source file:com.sun.honeycomb.admin.mgmt.server.HCCellAdapterBase.java
/** * Update the service tag data associated with a single cell. This routine * must be called on ever cell in order to keep the silo_info.xml. On * the master node this will clear the registry file. If the cell is * a single cell system the registry file will be updated. An update * does not happen on multi-cell since we can't update all the instanceIDs * on all cells. Therefore we required the operator to do a * "servicetags --refresh"/*from w w w . j a v a 2 s .c o m*/ * @param evt the callback handle * @param cellData the service tag data to update * @return BigInteger, 0 for SUCCESS, -1 for failure, -2 for failed * to update registry file on a single cell system. * Currently always returns 0 * @throws com.sun.honeycomb.mgmt.common.MgmtException */ public BigInteger updateServiceTagData(EventSender evt, HCServiceTagCellData cellData) throws MgmtException { MultiCellLib multiCell = MultiCellLib.getInstance(); boolean isStandAlone = multiCell.isCellStandalone(); StringBuffer buf = new StringBuffer(); buf.append(" service tag data on cell"); if (isStandAlone == false) { buf.append(" ").append(cellData.getCellId()).append(" on cell "); buf.append(getCellId()); } buf.append("."); Reassure reassureThread = new Reassure(evt); try { reassureThread.start(); boolean isSupported = ServiceTagsRegistry.isSupported(); boolean isMaster = multiCell.isCellMaster(); if (isMaster) { // If we modify an service tag data the service tag registry // is considered out of date. As such we clear the registry // of all ST5800 service tags. if (isSupported) clearRegistry(); } String instanceURN = null; if (isStandAlone) { // When we have a single cell system we can automatically // update the service tag registry. On a multi-cell hive // this isn't possible since we can't update all the // instance information on all the cells. The operator // in that scenario must follow up with a "servicetag --refresh" // command. instanceURN = ServiceTag.generateInstanceURN(); } ServiceTagData data = new ServiceTagData(cellData.getProductNumber(), cellData.getProductSerialNumber(), cellData.getMarketingNumber(), instanceURN); multiCell.updateServiceTagData(cellData.getCellId(), data); buf.insert(0, "Successfully updated"); logger.log(Level.INFO, buf.toString()); //evt.sendAsynchronousEvent(buf.toString()); if (isStandAlone) { // Reset the buf to new action in case of exception buf = new StringBuffer(" service tag registry."); ClusterProperties props = ClusterProperties.getInstance(); boolean disabled = props .getPropertyAsBoolean(ConfigPropertyNames.PROP_SERVICE_TAG_SERVICE_DISABLED); if (disabled) { evt.sendAsynchronousEvent( "Service Tag service is disabled service tag " + "registry file will not be updated."); return BigInteger.valueOf(CliConstants.SERVICE_TAG_REGISTRY_UPDATE_FAILURE); } // This is a single cell system. // We can automatically update the service tag registry if (isSupported == false) { evt.sendAsynchronousEvent(SERVICE_TAG_REGISTRY_IS_NOT_AVAILABLE_MSG); return BigInteger.valueOf(CliConstants.SERVICE_TAG_REGISTRY_UPDATE_FAILURE); } ServiceTagCellData[] cells = new ServiceTagCellData[] { new ServiceTagCellData(getCellId(), data) }; ServiceTagsGenerator generator = new ServiceTagsGenerator(cells); if (generator.isValid() == false) { // This should never happen on a single cell system buf = new StringBuffer().append("Failed to update service tag registry due to a ") .append("validation error.\nSee logs for further details."); // Validation errors found via ServiceTagsGenerator are // logged by default evt.sendAsynchronousEvent(buf.toString()); return BigInteger.valueOf(CliConstants.SERVICE_TAG_REGISTRY_VALIDATION_FAILURE); } else { ServiceTagsRegistry.update(generator.getServiceTags()); buf.insert(0, "Successfully updated"); evt.sendAsynchronousEvent(buf.toString()); logger.log(Level.INFO, buf.toString()); } } return BigInteger.ZERO; } catch (MgmtException me) { buf.insert(0, "Failed to update"); logger.log(Level.SEVERE, buf.toString(), me); buf.append(" Reason: "); buf.append(me.getMessage()); buf.append(".\n"); buf.append("Ensure that the servicetag entries are all valid by invoking the command,"); buf.append("'servicetags --refresh'"); evt.sendAsynchronousEvent(buf.toString()); return BigInteger.valueOf(CliConstants.FAILURE); } catch (Exception ex) { buf.insert(0, "Failed to update"); logger.log(Level.SEVERE, buf.toString(), ex); buf.append(" Reason: "); buf.append(ex.getMessage()); buf.append(".\n"); buf.append("Ensure that the servicetag entries are all valid by invoking the command,"); buf.append("'servicetags --refresh'"); evt.sendAsynchronousEvent(buf.toString()); return BigInteger.valueOf(CliConstants.FAILURE); } finally { if (reassureThread != null) reassureThread.safeStop(); } }
From source file:energy.usef.dso.service.business.DsoPlanboardBusinessService.java
/** * Updates the aggregaters linked to the congestionPoint. * * @param xmlCongestionPoint {@link CongestionPoint} for which the aggregator count will be updated. * @param initializationDate {@link LocalDate} date of the initializtion of the aggregator count. * @param initializationDuration {@link Integer} duration of the initalization. *//* w ww . jav a 2s . c o m*/ public void updateAggregatorsOnCongestionPointConnectionGroup(CongestionPoint xmlCongestionPoint, LocalDate initializationDate, Integer initializationDuration) { CongestionPointConnectionGroup congestionPoint = congestionPointConnectionGroupRepository .findOrCreate(xmlCongestionPoint.getEntityAddress(), config.getProperty(ConfigParam.HOST_DOMAIN)); List<AggregatorOnConnectionGroupState> endingAtDate = aggregatorOnConnectionGroupStateRepository .findEndingAggregatorOnConnectionGroupStates(congestionPoint.getUsefIdentifier(), initializationDate); // for each ending aggregator/connection group state for which nothing is updated, extend the valid until date. endingAtDate.stream() .filter(aocgs -> xmlCongestionPoint.getAggregator().stream() .anyMatch(aggregator -> aocgs.getConnectionCount().equals(aggregator.getConnectionCount()) && aocgs.getAggregator().getDomain().equals(aggregator.getDomain()) && aocgs.getCongestionPointConnectionGroup().getUsefIdentifier() .equals(xmlCongestionPoint.getEntityAddress()))) .forEach(aocgs -> aocgs.setValidUntil(aocgs.getValidUntil().plusDays(initializationDuration))); // create new records if anything changed xmlCongestionPoint.getAggregator().stream() .filter(aggregator -> endingAtDate.stream() .noneMatch(aocgs -> aocgs.getConnectionCount().equals(aggregator.getConnectionCount()) && aocgs.getAggregator().getDomain().equals(aggregator.getDomain()) && aocgs.getCongestionPointConnectionGroup().getUsefIdentifier() .equals(xmlCongestionPoint.getEntityAddress()))) .filter(xmlAggregator -> StringUtils.isNotEmpty(xmlAggregator.getDomain())) .forEach(xmlAggregator -> { Aggregator dbAggregator = aggregatorRepository.findOrCreate(xmlAggregator.getDomain()); AggregatorOnConnectionGroupState newState = new AggregatorOnConnectionGroupState(); newState.setAggregator(dbAggregator); newState.setConnectionCount(xmlAggregator.getConnectionCount() == null ? BigInteger.ZERO : xmlAggregator.getConnectionCount()); newState.setValidFrom(initializationDate); newState.setValidUntil(initializationDate.plusDays(initializationDuration)); newState.setCongestionPointConnectionGroup(congestionPoint); aggregatorOnConnectionGroupStateRepository.persist(newState); }); }
From source file:com.sdcs.courierbooking.service.UserServiceImpl.java
@Override public String bulkCouriers(String strBulkName, String strBulkMobile, String strBulkEmail) { JSONObject responseJsonBulk = new JSONObject(); long resultofBulk = userDao.bulkCouriers(strBulkName, strBulkMobile, strBulkEmail); if (resultofBulk > 0) { String mailBody = "<b>Dear " + strBulkName + ",</b>" + "<br>" + "<b><i> Thank you for choosing SDCS.</i></b>" + "<p> we will get back to you soon.</b>" + "<br>" + "Thanks" + "<br>" + "SDCS Team" + "<br>" + "info@sdcs.me"; SdcsEmailComponent.sendMail(strBulkEmail, "SDCS - Bulk Orders", mailBody, BigInteger.ZERO); String strSmsText = "%20Welcome%20to%20SDCS%20" + strBulkName + ".%20Thank%20you%20for%20Choosing%20SDCS.%20"; SdcsSMSComponent.sendSms(strBulkMobile, strSmsText); responseJsonBulk.put("status", true); responseJsonBulk.put("strname", strBulkName); responseJsonBulk.put("strMobile", strBulkMobile); responseJsonBulk.put("strEmail", strBulkEmail); } else {/*w w w. ja va 2 s.c om*/ responseJsonBulk.put("status", false); } return responseJsonBulk.toString(); // TODO Auto-generated method stub }
From source file:cc.mintcoin.wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { log.info("service start command: " + intent + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT) ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")" : "")); //log.info("org.bitcoin.NativeSecp256k1.enabled=" + org.bitcoin.NativeSecp256k1.enabled); if (blockChain == null) { boolean blockChainFileExists = blockChainFile.exists(); boolean tryStarting = true; if (DownloadCompleteReceiver.isDownloading(application)) { log.info("isDownloading"); DownloadCompleteReceiver.updateDownloadState(application); // it can fix itself this way tryStarting = false;//from www . j a v a2 s . com } else if (!blockChainFileExists) { if (DownloadCompleteReceiver.isObbAvailable(application)) { initializeBlockchainFast(); tryStarting = true; } else if (intent.getBooleanExtra(DownloadCompleteReceiver.INTENT_EXTRA_SKIP_OBB_INIT, false)) { tryStarting = true; } else { // open dialog box to ask user what to do for download Intent intent2 = new Intent(this, InitialBlockchainActivity.class); intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent2); tryStarting = false; } } if (tryStarting) { try { startBlockChain(); } catch (Error e) { stopSelf(); throw e; } } else { stopSelf(); } } String action = intent.getAction(); if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) { notificationCount = 0; notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) { log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; stopSelf(); } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) { final Sha256Hash hash = new Sha256Hash( intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH)); final Transaction tx = application.getWallet().getTransaction(hash); if (peerGroup != null) { log.info("broadcasting transaction " + tx.getHashAsString()); peerGroup.broadcastTransaction(tx); } else { log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString()); } } return START_NOT_STICKY; }
From source file:piuk.blockchain.android.MyRemoteWallet.java
public void sendCoinsAsync(final HashMap<String, BigInteger> sendingAddresses, final String toAddress, final BigInteger amount, final FeePolicy feePolicy, final BigInteger fee, final String changeAddress, final SendProgress progress) { BigInteger sum = BigInteger.ZERO; for (Iterator<Entry<String, BigInteger>> iterator = sendingAddresses.entrySet().iterator(); iterator .hasNext();) {// www.jav a 2 s . c o m Entry<String, BigInteger> entry = iterator.next(); sum = sum.add(entry.getValue()); } if (sum.compareTo(amount) != 0) { progress.onError("Internal error input amounts not validating correctly"); return; } HashMap<String, BigInteger> receivingAddresses = new HashMap<String, BigInteger>(); receivingAddresses.put(toAddress, amount); sendCoinsAsync(false, sendingAddresses, receivingAddresses, feePolicy, fee, changeAddress, progress); }
From source file:org.estatio.api.Api.java
@ActionSemantics(Of.IDEMPOTENT) public void putLeasePostalAddress(@Named("partyReference") final String partyReference, @Named("agreementRoleType") final String agreementRoleType, @Named("leaseReference") @Optional final String leaseReference, @Named("address1") @Optional final String address1, @Named("address2") @Optional final String address2, @Named("address3") @Optional final String address3, @Named("postalCode") @Optional final String postalCode, @Named("city") @Optional final String city, @Named("stateCode") @Optional final String stateCode, @Named("countryCode") @Optional final String countryCode, @Named("isInvoiceAddress") @Optional final BigInteger isInvoiceAddress) { if (address1 != null && partyReference != null && leaseReference != null) { final Lease lease = fetchLease(leaseReference); final Party party = fetchParty(partyReference); final AgreementRoleCommunicationChannelType agreementRoleCommunicationChannelType = agreementRoleCommunicationChannelTypes .findByTitle(/* w ww.j a v a2 s . c o m*/ isInvoiceAddress.compareTo(BigInteger.ZERO) == 0 ? LeaseConstants.ARCCT_INVOICE_ADDRESS : LeaseConstants.ARCCT_ADMINISTRATION_ADDRESS); if (agreementRoleCommunicationChannelType == null) throw new ApplicationException(String.format("AgreementRoleCommunicationChannelType not found.")); PostalAddress address = (PostalAddress) postalAddresses.findByAddress(party, address1, postalCode, city, fetchCountry(countryCode)); if (address == null) { address = communicationChannels.newPostal(party, CommunicationChannelType.POSTAL_ADDRESS, address1, address2, null, postalCode, city, fetchState(stateCode, false), fetchCountry(countryCode, false)); } final AgreementRoleType art = agreementRoleTypes .findByTitle(StringUtils.capitalize(agreementRoleType.toLowerCase())); if (art == null) throw new ApplicationException(String.format("AgreementRoleType %s not found.", agreementRoleType)); final AgreementRole role = lease.findRole(party, art, clockService.now()); if (role == null) throw new ApplicationException( String.format("Role for %s, %s not found.", partyReference, agreementRoleType)); role.addCommunicationChannel(agreementRoleCommunicationChannelType, address); } }
From source file:piuk.blockchain.android.MyRemoteWallet.java
private void sendCoinsAsync(final boolean isSimpleSend, final HashMap<String, BigInteger> sendingAddresses, final HashMap<String, BigInteger> receivingAddresses, final FeePolicy feePolicy, final BigInteger fee, final String changeAddress, final SendProgress progress) { new Thread() { @Override//www . ja va 2s. co m public void run() { progress.onStart(); final BigInteger feeAmount; if (fee == null) feeAmount = BigInteger.ZERO; else feeAmount = fee; final List<ECKey> tempKeys = new ArrayList<ECKey>(); try { //Construct a new transaction progress.onProgress("Getting Unspent Outputs"); List<String> from = new ArrayList<String>(sendingAddresses.keySet()); List<MyTransactionOutPoint> allUnspent = getUnspentOutputPoints( from.toArray(new String[from.size()])); Pair<Transaction, Long> pair = null; progress.onProgress("Constructing Transaction"); try { //Try without asking for watch only addresses List<MyTransactionOutPoint> unspent = filter(allUnspent, tempKeys, false, progress); if (isSimpleSend) { pair = makeTransaction(isSimpleSend, unspent, receivingAddresses, feeAmount, changeAddress); } else { pair = makeTransactionCustom(sendingAddresses, unspent, receivingAddresses, feeAmount, changeAddress); } //Transaction cancelled if (pair == null) return; } catch (InsufficientFundsException e) { //Try with asking for watch only List<MyTransactionOutPoint> unspent = filter(allUnspent, tempKeys, true, progress); if (isSimpleSend) { pair = makeTransaction(isSimpleSend, unspent, receivingAddresses, feeAmount, changeAddress); } else { pair = makeTransactionCustom(sendingAddresses, unspent, receivingAddresses, feeAmount, changeAddress); } //Transaction cancelled if (pair == null) return; } Transaction tx = pair.first; Long priority = pair.second; if (isSimpleSend) { //If returns false user cancelled //Probably because they want to recreate the transaction with different fees if (!progress.onReady(tx, feeAmount, feePolicy, priority)) return; } progress.onProgress("Signing Inputs"); Wallet wallet = new Wallet(MainNetParams.get()); for (TransactionInput input : tx.getInputs()) { byte[] scriptBytes = input.getOutpoint().getConnectedPubKeyScript(); String address = new BitcoinScript(scriptBytes).getAddress().toString(); final ECKey walletKey; try { walletKey = getECKey(address); } catch (Exception e) { // skip add Watch Only Bitcoin Address key because already accounted for later with tempKeys continue; } ECKey keyCompressed; ECKey keyUnCompressed; BigInteger priv = new BigInteger(walletKey.getPrivKeyBytes()); if (priv.compareTo(BigInteger.ZERO) >= 0) { keyCompressed = new ECKey(priv, null, true); keyUnCompressed = new ECKey(priv, null, false); } else { byte[] appendZeroByte = ArrayUtils.addAll(new byte[1], walletKey.getPrivKeyBytes()); BigInteger priv2 = new BigInteger(appendZeroByte); keyCompressed = new ECKey(priv2, null, true); keyUnCompressed = new ECKey(priv2, null, false); } if (keyCompressed != null) { wallet.addKey(keyCompressed); } if (keyUnCompressed != null) { wallet.addKey(keyUnCompressed); } } wallet.addKeys(tempKeys); //Now sign the inputs tx.signInputs(SigHash.ALL, wallet); progress.onProgress("Broadcasting Transaction"); String response = pushTx(tx); progress.onSend(tx, response); } catch (Exception e) { e.printStackTrace(); progress.onError(e.getLocalizedMessage()); } } }.start(); }