Executes a task within a read-only transaction. Any exception rolls back the transaction and gets rethrown as a RuntimeException.
7628
public <T, F> T doReadOnly(F facility, Task<T, F> task) {
        return doTransaction(facility, task, _readonly);
    }
197342
public void execute() {

    while (!steps.isEmpty()) {
      currentStep = steps.remove(0);

      try {
        LOG.debugPerformOperationStep(currentStep.getName());

        currentStep.performOperationStep(this);
        successfulSteps.add(currentStep);

        LOG.debugSuccessfullyPerformedOperationStep(currentStep.getName());
      }
      catch (Exception e) {

        if(isRollbackOnFailure) {

          try {
            rollbackOperation();
          }
          catch(Exception e2) {
            LOG.exceptionWhileRollingBackOperation(e2);
          }
          // re-throw the original exception
          throw LOG.exceptionWhilePerformingOperationStep(name, currentStep.getName(), e);
        }

        else {
          LOG.exceptionWhilePerformingOperationStep(currentStep.getName(), e);
        }

      }
    }

  }
120004
public <T> T execute(Task<T> task) {
        synchronized(task) {
            task.reset();
            // add it to the tail
            taskList.add(task);

            // invoke the execution
            lock.activate();

            // wait for the completion
            try {
            	while (!task.isDone()) {
            		task.wait();
            	}
            } catch (InterruptedException e) {
                task.exception = e; // we got interrupted, so task.result will be invalid! 
            }

            if(task.exception!=null) {
                Throwable e = task.exception;
                task.exception = null;
                throw new ExecutionException(e);
            } else {
                T r = task.result;
                task.result = null;
                return r;
            }
        }
    }
486186
private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
        Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
        if (this.enterpriseConcurrentScheduler) {
            result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
        }
        return result;
    }
978387
public void execute(TransactionCommon t) throws Throwable
    {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.entry(tc, "execute", t);

      _aiStream.removeCompletedPrefix(
        t,
        _messageProcessor.getMessageStore().getUniqueLockID(AbstractItem.STORE_NEVER));
      synchronized (_persistentStreamState)
      {
        if (_streamStateRemoveNeedsToWait)
        {
          _persistentStreamState.wait();
        }

        long lockID = _messageProcessor.getMessageStore().getUniqueLockID(AbstractItem.STORE_NEVER);
        _persistentStreamState.lockItemIfAvailable(lockID);
        Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(t);
        _persistentStreamState.remove(msTran, lockID);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "execute");
    }
181472
public void submitSynchronous(Runnable task) {
        lock.writeLock().lock();
        try {
            awaitInner();
            task.run();
        } catch (InterruptedException e) {
            Log.error(e, "Task queue isolated submission interrupted");
            throw new RuntimeException(e);
        } catch (Exception e) {
            Log.error(e, "Task queue isolated submission failed");
            throw new RuntimeException(e);
        } finally {
            lock.writeLock().unlock();
        }
    }
13413
private void executeUpdatesAsynchronous(DBTransaction transaction) {
        Collection<BoundStatement> mutations = getMutations(transaction);
        List<ResultSetFuture> futureList = new ArrayList<>(mutations.size());
        for(BoundStatement mutation: mutations) {
            ResultSetFuture future = m_dbservice.getSession().executeAsync(mutation);
            futureList.add(future);
        }
        m_logger.debug("Waiting for {} asynchronous futures", futureList.size());
        for (ResultSetFuture future : futureList) {
            future.getUninterruptibly();
        }
    }
977431
private synchronized <R> OperationResult<R> executeDdlOperation(AbstractOperationImpl<R> operation, RetryPolicy retry)
             throws OperationException, ConnectionException {
         ConnectionException lastException = null;
         for (int i = 0; i < 2; i++) {
             operation.setPinnedHost(ddlHost);
             try {
                 OperationResult<R> result = connectionPool.executeWithFailover(operation, retry);
                 ddlHost = result.getHost();
                 return result;
             }
             catch (ConnectionException e) {
                lastException = e;
                if (e instanceof IsDeadConnectionException) {
                     ddlHost = null;
                }
             }
         }
         throw lastException;
    }
16941
@Override
    public void readTask(Task task) {
        super.readTask(task);
        this.description = task.getProperty(DESCRIPTION_KEY);
        this.contentChecksum = task.getProperty(CONTENT_CHECKSUM_KEY);
        this.storeChecksum = task.getProperty(STORE_CHECKSUM_KEY);
        this.storeType = StorageProviderType.valueOf(task.getProperty(STORE_TYPE_KEY));
        this.manifestChecksum = task.getProperty(MANIFEST_CHECKSUM_CHECKSUM_KEY);
    }
711933
public void process(final Task<Revision> task)
		throws DiffException, TimeoutException, UnsupportedEncodingException
	{
		// this.startTime = System.currentTimeMillis();
		Revision revision;

		// check if a new task was received
		if (articleID != task.getHeader().getArticleId()) {

			// init settings
			initNewTask(task.getHeader().getArticleId());
			init(task);

			// check if old task was complete
		}
		else if (result == null) {

			init(task);
		}

		Diff diff;

		// TODO: Chronological order hotfix -
		// does not work for articles that are split across multiple tasks
		ArrayList<Revision> list = task.getContainer();
		Collections.sort(list);

		int i, rSize = list.size();

		for (i = 0; i < rSize; i++) {

			if (result.byteSize() > LIMIT_TASK_SIZE_DIFFS) {

				transmitPartialTask(result);
				init(task);
			}

			// Store previous revision
			revPrevious = revCurrent;

			// Process next revision
			revision = list.get(i);

			diff = processRevision(revision);

			if (diff != null) {

				revCurrent = revTemp;

				// Add to result
				revisionCounter++;

				diff.setRevisionCoutner(revisionCounter);
				diff.setRevisionID(revision.getRevisionID());
				diff.setTimeStamp(revision.getTimeStamp());
				diff.setComment(revision.getComment());
				diff.setContributorName(revision.getContributorName());
				diff.setContributorId(revision.getContributorId());
				diff.setContributorIsRegistered(revision.contributorIsRegistered());
				diff.setMinor(revision.isMinor());

				result.add(diff);

				// Verification
				if (VERIFICATION_DIFF) {
					String revC, revP;
					try {
						revC = String.valueOf(revCurrent);
						revP = diff.buildRevision(revPrevious);

						/*
						 * WRONG LOCATION if (notEqual && MODE_SURROGATES ==
						 * SurrogateModes.REPLACE) {
						 *
						 * // TODO: TEST: if (Surrogates.scan(revCurrent)) {
						 *
						 * char[] repCurrent = Surrogates.replace(revCurrent);
						 * char[] repPrevious = Surrogates.replace(revPrevious);
						 *
						 * revC = String.valueOf(repCurrent); revP =
						 * diff.buildRevision(repPrevious);
						 *
						 * notEqual = !revC.equals(revP); } }
						 */

						if (!revC.equals(revP)) {

							if (MODE_DEBUG_OUTPUT_ACTIVATED) {
								WikipediaXMLWriter writer = new WikipediaXMLWriter(
										LOGGING_PATH_DIFFTOOL
												+ LOGGING_PATH_DEBUG
												+ task.getHeader()
														.getArticleName()
												+ ".dbg");

								writer.writeRevision(task);
								writer.close();
							}

							throw ErrorFactory
									.createDiffException(
											ErrorKeys.DIFFTOOL_DIFFCONSUMER_DIFF_VERIFICATION_FAILED,
											"Reconstruction of "
													+ task.toString()
													+ " failed at revision "
													+ revisionCounter + ".");
						}

						// Throw again
					}
					catch (DiffException e) {
						throw e;

						// Catch unexpected exceptions
					}
					catch (Exception e) {
						throw ErrorFactory
								.createDiffException(
										ErrorKeys.DIFFTOOL_DIFFCONSUMER_DIFF_VERIFICATION_FAILED,
										"Reconstruction of " + task.toString()
												+ " failed at revision "
												+ revisionCounter + ".", e);
					}
				}
			}
		}

		transmitAtEndOfTask(task, result);
	}
509609
private synchronized void runTask(Task task) {
        if (taskThread == null) {
            taskThread = new TaskThread();
        }
        taskThread.runTask(task);
    }
1312689
@Override
    public void run() throws Exception {
        QueueContainer queueContainer = getContainer();
        if (queueContainer.hasEnoughCapacity(txSize + 1)) {
            response = queueContainer.txnOfferReserve(transactionId);
        }
    }
515068
def execute_read_only(*args, **kwargs):
        # TODO: consolidate with execute
        

        # Inspect the call stack for the originating call
        args = CoyoteDb.__add_query_comment(args[0])

        # Execute the query
        db = CoyoteDb.__get_db_read_instance()
        cursor = db.cursor()
        try:
            cursor.execute(*args, **kwargs)
        except OperationalError, e:
            raise OperationalError('{} when executing: {}'.format(e.args, args[0]))
        return db, cursor
730848
public void execute() {
    Entry head;
    synchronized(this) {
      head = this.head;
      this.head = null;
    }
    while (head != null) {
      try {
        head.runnable.run();
      } catch (Throwable t) {
        platform.reportError("Failure executing runnable: " + head.runnable, t);
      }
      head = head.next;
    }
  }
454929
@Override
    public void execute(Runnable task) {
        try {
            this.concurrentExecutor.execute(task);
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + this.concurrentExecutor + "] did not accept task: " + task,
                    ex);
        }
    }
1109701
public void execute(Runnable statements)
	{
		try (HibernateTransaction tx = start().withAutoRollback())
		{
			statements.run();

			// Success, perform a TX commit
			tx.commit();
		}
	}
1283561
@Override
    public void execute() throws TaskExecutionFailedException {
        String account = bitTask.getAccount();
        String storeId = bitTask.getStoreId();
        String spaceId = bitTask.getSpaceId();
        log.info("starting space comparison where account={} storeId={} spaceId={}",
                 account,
                 storeId,
                 spaceId);

        File spaceListing = null;
        try {

            //write out space listing to file, counting all the items in the process.
            spaceListing = File.createTempFile("spaces", ".txt");
            int count = 0;
            try (BufferedWriter writer = new BufferedWriter(new FileWriter(spaceListing))) {
                Iterator<String> it = store.getSpaceContents(spaceId, null);
                while (it.hasNext()) {
                    if (count > 0) {
                        writer.write("\n");
                    }
                    writer.write(it.next());
                    count++;
                }
                writer.close();
            }

            //load the set of content ids
            WriteOnlyStringSet set = new WriteOnlyStringSet(count);
            try (BufferedReader reader = new BufferedReader(new FileReader(spaceListing))) {
                String contentId = null;
                while ((contentId = reader.readLine()) != null) {
                    set.add(contentId);
                }
            }

            // iterate current non-deleted manifest items
            Iterator<ManifestItem> manifestIterator =
                this.manifestStore.getItems(account, storeId, spaceId, false);

            while (manifestIterator.hasNext()) {
                // if not in storage provider
                ManifestItem item = manifestIterator.next();

                String contentId = item.getContentId();
                if (set.contains(contentId)) {
                    // reset missingInStorageProvider flag to false if true.
                    if (item.isMissingFromStorageProvider()) {
                        manifestStore.updateMissingFromStorageProviderFlag(account,
                                                                           storeId,
                                                                           spaceId,
                                                                           contentId,
                                                                           false);
                    }
                } else {
                    log.debug("no content found in storage provider for manifest item: {}", item);
                    if (!item.isDeleted()) {
                        // is missingInStorageProvider flag true?
                        if (item.isMissingFromStorageProvider()) {
                            this.bitLogStore
                                .write(account,
                                       storeId,
                                       spaceId,
                                       contentId,
                                       new Date(),
                                       storageProviderType,
                                       BitIntegrityResult.ERROR,
                                       null,
                                       null,
                                       item.getContentChecksum(),
                                       "Content item is in the manifest "
                                       + "but not in the storage provider in "
                                       + "the course of the last two bit integrity runs.");

                        } else {
                            manifestStore
                                .updateMissingFromStorageProviderFlag(account,
                                                                      storeId,
                                                                      spaceId,
                                                                      contentId,
                                                                      true);
                        }
                    }

                }
            }

        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            throw new TaskExecutionFailedException("failed to complete task: "
                                                   + ex.getMessage(), ex);
        } finally {
            if (spaceListing != null && spaceListing.exists()) {
                spaceListing.delete();
            }
        }
    }