called in operation threads
346387
public void clearReplicaSyncRequest(int partitionId, ServiceNamespace namespace, int replicaIndex) {
        ReplicaFragmentSyncInfo syncInfo = new ReplicaFragmentSyncInfo(partitionId, namespace, replicaIndex, null);
        if (!replicaSyncRequests.remove(syncInfo)) {
            return;
        }

        if (logger.isFinestEnabled()) {
            logger.finest("Clearing sync replica request for partitionId=" + partitionId + ", replicaIndex="
                    + replicaIndex + ", namespace=" + namespace);
        }
        releaseReplicaSyncPermits(1);
        replicaSyncTimeoutScheduler.cancelIfExists(syncInfo, null);
    }
1807
protected void invoke(String serviceName, Operation operation, int partitionId) {
        try {
            operationCount++;
            operationService
                    .invokeOnPartition(serviceName, operation, partitionId)
                    .andThen(mergeCallback);
        } catch (Throwable t) {
            throw rethrow(t);
        }
    }
207411
private void done()
   {
      if (longThreadPool != null && isLong)
      {
         transport.updateLongRunningFree(address,
                                         longThreadPool.getNumberOfFreeThreads() + 1);
      }
      else
      {
         transport.updateShortRunningFree(address,
                                          shortThreadPool.getNumberOfFreeThreads() + 1);
      }
   }
1186993
protected function runOperations() {
		foreach( $this->operations as $operation ) {
			$operation->setTransactionOperationSet($this);
			$operation->runIfValid();
		}
	}
691217
@Override
    protected void doActionsInEventThread() {
        if (component instanceof ComboBox) {
            ((ComboBox<?>) component).getSelectionModel().select(mIndex);
        } else if (component instanceof ListView) {
            ((ListView<?>) component).getSelectionModel().select(mIndex);
        }
    }
1240114
public void threadAccepted(IVdmThread thread, boolean first)
	{
		if (first)
		{
			DebugEventHelper.fireExtendedEvent(this, ExtendedDebugEventDetails.BEFORE_CODE_LOADED);
			initialized = true;
			fireTargetInitialized();
		}
	}
834682
public void operationEnded(InvokeImpl tcInvokeRequestImpl) {
        try {
            this.dialogLock.lock();
            // this op died cause of timeout, TC-L-CANCEL!
            int index = getIndexFromInvokeId(tcInvokeRequestImpl.getInvokeId());
            freeInvokeId(tcInvokeRequestImpl.getInvokeId());
            this.operationsSent[index] = null;
            // lets call listener
            // This is done actually with COmponentIndication ....
        } finally {
            this.dialogLock.unlock();
        }
    }
48733
function() {
      this.threadsByLinuxPid = {};
      this.model_.getAllThreads().forEach(
          function(thread) {
            this.threadsByLinuxPid[thread.tid] = thread;
          }.bind(this));
    }
327800
public void run(Collection<Runnable> tasks) {
        // Create a semphore that the wrapped runnables will execute
        int numTasks = tasks.size();
        CountDownLatch latch = new CountDownLatch(numTasks);
        for (Runnable r : tasks) {
            if (r == null)
                throw new NullPointerException("Cannot run null tasks");
            workQueue.offer(new CountingRunnable(r, latch));
        }
        try {
            // Wait until all the tasks have finished
            latch.await();
        }
        catch (InterruptedException ie) {
            throw new IllegalStateException("Not all tasks finished", ie);
        }
    }
12499
private <T> T execute(Operation<T> operation) throws Exception {
    return execute(operation, null);
  }
379239
@Override
    public <K, V, R> R invoke(Cache<K, V> cache, Operation<K, V, R> operation, Flag... allFlags) {
        Flag[] attemptFlags = null;
        // attemptFlags = allFlags - Flag.FAIL_SILENTLY
        if ((allFlags != null) && (allFlags.length > 0)) {
            Set<Flag> flags = EnumSet.noneOf(Flag.class);
            flags.addAll(Arrays.asList(allFlags));
            flags.remove(Flag.FAIL_SILENTLY);
            attemptFlags = flags.toArray(new Flag[flags.size()]);
        }

        Exception exception = null;

        for (int i = 0; i <= this.backOffIntervals.length; ++i) {
            // Make sure Flag.FAIL_SILENTLY, if specified, is applied to the last try only
            try {
                return this.invoker.invoke(cache, operation, (i < this.backOffIntervals.length) ? attemptFlags : allFlags);
            } catch (TimeoutException e) {
                exception = e;
            }

            if (i < this.backOffIntervals.length) {
                int delay = this.backOffIntervals[i];

                try {
                    if (ROOT_LOGGER.isTraceEnabled()) {
                        ROOT_LOGGER.tracef(exception, "Cache operation failed.  Retrying in %d ms", Integer.valueOf(delay));
                    }

                    Thread.sleep(delay);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }
        }

        throw MESSAGES.abortingCacheOperation(exception, this.backOffIntervals.length + 1);
    }
152375
@SuppressWarnings("unchecked")
  public <T extends CoreExecution> void performOperation(CoreAtomicOperation<T> operation) {
    LOG.debugPerformingAtomicOperation(operation, this);
    operation.execute((T) this);
  }
1368792
@Override
    public I_CmsReportThread initializeThread() {

        List resources = new ArrayList();
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamResources())) {
            resources = CmsStringUtil.splitAsList(getParamResources(), ",");
        }
        resources = CmsFileUtil.removeRedundancies(resources);

        CmsRemovePubLocksThread thread = new CmsRemovePubLocksThread(getCms(), resources);
        return thread;
    }
956278
public static void finishThread(){
    //--Create Task
    final long threadId = Thread.currentThread().getId();
    Runnable finish = new Runnable(){
      public void run(){
        releaseThreadControl(threadId);
      }
    };
    //--Run Task
    if(isThreaded){
      //(case: multithreaded)
      attemptThreadControl( threadId, finish );
    } else {
      //(case: no threading)
      throw new IllegalStateException("finishThreads() called outside of threaded environment");
    }
  }
546294
private void runInMainThread(Runnable runnable) {
        if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
            mHandler.post(runnable);
        } else {
            runnable.run();
        }
    }
331810
private void addThread() {
        Thread t = new WorkerThread(workQueue);
        threads.add(t);
        t.start();            
    }
1193102
public final void run() {
        int partitionCount = partitionService.getPartitionCount();
        latch = new CountDownLatch(partitionCount);

        for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
            operationExecutor.execute(new CollectContainerRunnable(partitionId));
        }

        try {
            latch.await();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }