When this is invoked, the work is running with context on the thread.

@see java.lang.Runnable.run()
490340
@Override
    public void run() {
        JCASecurityContext ctx = bootstrapContext.getJCASecurityContext();
        if (ctx != null)
            ctx.runInInboundSecurityContext(work);
        else
            work.run();
    }
33093
@Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                int count = collectionService.commitAnnotations(ANNOTATION_CHUNK_SIZE, TIMEOUT);

                if (count > 0) {
                    LOGGER.info(MessageFormat.format("Committed {0} annotations.", count));
                    jobCounter.addAndGet(count);
                }
                Thread.sleep(POLL_INTERVAL_MS);
            } catch (InterruptedException ie) {
                LOGGER.info("Execution was interrupted.");
                Thread.currentThread().interrupt();
                break;
            } catch (Throwable ex) {
                LOGGER.info("Error occurred while committing annotations. Reason {}", ex.toString());
            }
        }
        LOGGER.warn(MessageFormat.format("Annotation committer thread interrupted. {} annotations committed by this thread.", jobCounter.get()));
        collectionService.dispose();
        monitorService.dispose();
    }
1208169
@Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {

        }
        //TODO replace me with a timer task
        while (running) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (needsDataRefresh) {
                if (System.currentTimeMillis() - lastMovement > 500) {
                    generateMap();
                    needsDataRefresh = false;
                }
            }
        }
    }
370760
@Override
    public void run() {
        try {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "Run WriteListenerRunnable start , current thread -->" + Thread.currentThread().getName());
            }
            // clean up everything on this thread
            WebContainerRequestState reqState = WebContainerRequestState.getInstance(false);
            if (reqState != null) {
                reqState.init();
            }
            // Push the original thread's context onto the current thread, also
            // save off the current thread's context
            _tcm.pushContextData();

            // call onWritePossible
            synchronized (this._out) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                    Tr.debug(tc, "Invoking the onWritePossible first time");
                }
                WebContainerRequestState.getInstance(true).setAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread", true);
                this._listener.onWritePossible();

            }
        } catch (Exception e) {
            // If any other exception is thrown then call error which will set
            // exception from error which will allow application to write error
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "An exception occurred during the onWritePossible : " + e);
            }
            _cb.error(_out.getBufferHelper().get_vc(), e);

        } finally {
            // Revert back to the thread's current context
            _tcm.popContextData();
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "Run WriteListenerRunnable done");
            }
        }
    }
171
public void run(Context context) throws IOException, InterruptedException {
    setup(context);
    while (context.nextKeyValue()) {
      map(context.getCurrentKey(), context.getCurrentValue(), context);
    }
    cleanup(context);
  }
498727
@Override
    public void run () {
        try {
            this.closed = true;
            close();
        }
        catch ( CIFSException e ) {
            log.warn("Failed to close context on shutdown", e);
        }
    }
360583
public void run(Runnable runnable)
    {
        if (this.goForward())
        {
            for (int i = this.from; i <= this.to; i += this.step)
            {
                runnable.run();
            }
        }
        else
        {
            for (int i = this.from; i >= this.to; i += this.step)
            {
                runnable.run();
            }
        }
    }
1107271
@Override
  public void execute(Runnable runnable) {
    if (runnable == null) {
      throw new NullPointerException("runnable parameter is null");
    }

    if (!mWorkQueue.offer(runnable)) {
      throw new RejectedExecutionException(
          mName + " queue is full, size=" + mWorkQueue.size());
    }

    final int queueSize = mWorkQueue.size();
    final int maxSize = mMaxQueueSize.get();
    if ((queueSize > maxSize) && mMaxQueueSize.compareAndSet(maxSize, queueSize)) {
      FLog.v(TAG, "%s: max pending work in queue = %d", mName, queueSize);
    } // else, there was a race and another thread updated and logged the max queue size

    startWorkerIfNeeded();
  }
825045
@Override
  public void run() {

    boolean lastAcquireFailed = false;

    while (!halted.get()) {
      try {
        // check if we're supposed to pause...
        synchronized (sigLock) {
          while (paused && !halted.get()) {
            try {
              // wait until togglePause(false) is called...
              sigLock.wait(1000L);
            } catch (InterruptedException ignore) {
            }
          }

          if (halted.get()) {
            break;
          }
        }

        int availThreadCount = quartzSchedulerResources.getThreadPool().blockForAvailableThreads();
        if (availThreadCount
            > 0) { // will always be true, due to semantics of blockForAvailableThreads...

          List<OperableTrigger> triggers = null;

          long now = System.currentTimeMillis();

          clearSignaledSchedulingChange();
          try {
            triggers =
                quartzSchedulerResources
                    .getJobStore()
                    .acquireNextTriggers(
                        now + idleWaitTime,
                        Math.min(availThreadCount, quartzSchedulerResources.getMaxBatchSize()),
                        quartzSchedulerResources.getBatchTimeWindow());
            lastAcquireFailed = false;
            logger.debug(
                "batch acquisition of " + (triggers == null ? 0 : triggers.size()) + " triggers");
          } catch (JobPersistenceException jpe) {

            lastAcquireFailed = true;
          } catch (RuntimeException e) {
            if (!lastAcquireFailed) {
              logger.error("quartzSchedulerThreadLoop: RuntimeException " + e.getMessage(), e);
            }
            lastAcquireFailed = true;
          }

          if (triggers != null && !triggers.isEmpty()) {

            now = System.currentTimeMillis();
            long triggerTime = triggers.get(0).getNextFireTime().getTime();
            long timeUntilTrigger = triggerTime - now;
            while (timeUntilTrigger > 2) {
              synchronized (sigLock) {
                if (halted.get()) {
                  break;
                }
                if (!isCandidateNewTimeEarlierWithinReason(triggerTime, false)) {
                  try {
                    // we could have blocked a long while
                    // on 'synchronize', so we must recompute
                    now = System.currentTimeMillis();
                    timeUntilTrigger = triggerTime - now;
                    if (timeUntilTrigger >= 1) {
                      sigLock.wait(timeUntilTrigger);
                    }
                  } catch (InterruptedException ignore) {
                  }
                }
              }
              if (releaseIfScheduleChangedSignificantly(triggers, triggerTime)) {
                break;
              }
              now = System.currentTimeMillis();
              timeUntilTrigger = triggerTime - now;
            }

            // this happens if releaseIfScheduleChangedSignificantly decided to release triggers
            if (triggers.isEmpty()) {
              continue;
            }

            // set triggers to 'executing'
            List<TriggerFiredResult> bndles = new ArrayList<TriggerFiredResult>();

            boolean goAhead = true;
            synchronized (sigLock) {
              goAhead = !halted.get();
            }
            if (goAhead) {
              try {
                List<TriggerFiredResult> res =
                    quartzSchedulerResources.getJobStore().triggersFired(triggers);
                if (res != null) {
                  bndles = res;
                }
              } catch (SchedulerException se) {
                quartzScheduler.notifySchedulerListenersError(
                    "An error occurred while firing triggers '" + triggers + "'", se);
              }
            }

            for (int i = 0; i < bndles.size(); i++) {

              TriggerFiredResult result = bndles.get(i);
              TriggerFiredBundle bndle = result.getTriggerFiredBundle();
              Exception exception = result.getException();

              if (exception instanceof RuntimeException) {
                logger.error("RuntimeException while firing trigger " + triggers.get(i), exception);

                continue;
              }

              // it's possible to get 'null' if the triggers was paused,
              // blocked, or other similar occurrences that prevent it being
              // fired at this time... or if the scheduler was shutdown (halted)
              if (bndle == null) {
                try {
                  quartzSchedulerResources.getJobStore().releaseAcquiredTrigger(triggers.get(i));
                } catch (SchedulerException se) {
                  quartzScheduler.notifySchedulerListenersError(
                      "An error occurred while releasing triggers '"
                          + triggers.get(i).getName()
                          + "'",
                      se);
                }
                continue;
              }

              // TODO: improvements:
              //
              // 2- make sure we can get a job runshell before firing triggers, or
              // don't let that throw an exception (right now it never does,
              // but the signature says it can).
              // 3- acquire more triggers at a time (based on num threads available?)

              JobRunShell shell = null;
              try {
                shell = quartzSchedulerResources.getJobRunShellFactory().createJobRunShell(bndle);
                shell.initialize(quartzScheduler);
              } catch (SchedulerException se) {
                try {
                  quartzSchedulerResources
                      .getJobStore()
                      .triggeredJobComplete(
                          triggers.get(i),
                          bndle.getJobDetail(),
                          CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR);
                } catch (SchedulerException se2) {
                  quartzScheduler.notifySchedulerListenersError(
                      "An error occurred while placing job's triggers in error state '"
                          + triggers.get(i).getName()
                          + "'",
                      se2);
                }
                continue;
              }

              if (quartzSchedulerResources.getThreadPool().runInThread(shell) == false) {
                try {
                  // this case should never happen, as it is indicative of the
                  // scheduler being shutdown or a bug in the thread pool or
                  // a thread pool being used concurrently - which the docs
                  // say not to do...
                  logger.error("ThreadPool.runInThread() return false!");
                  quartzSchedulerResources
                      .getJobStore()
                      .triggeredJobComplete(
                          triggers.get(i),
                          bndle.getJobDetail(),
                          CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR);
                } catch (SchedulerException se2) {
                  quartzScheduler.notifySchedulerListenersError(
                      "An error occurred while placing job's triggers in error state '"
                          + triggers.get(i).getName()
                          + "'",
                      se2);
                }
              }
            }

            continue; // while (!halted)
          }
        } else { // if(availThreadCount > 0)
          // should never happen, if threadPool.blockForAvailableThreads() follows contract
          continue; // while (!halted)
        }

        long now = System.currentTimeMillis();
        long waitTime = now + getRandomizedIdleWaitTime();
        long timeUntilContinue = waitTime - now;
        synchronized (sigLock) {
          try {
            sigLock.wait(timeUntilContinue);
          } catch (InterruptedException ignore) {
          }
        }

      } catch (RuntimeException re) {
        logger.error("Runtime error occurred in main trigger firing loop.", re);
      }
    } // while (!halted)

    // drop references to scheduler stuff to aid garbage collection...
    quartzScheduler = null;
    quartzSchedulerResources = null;
  }
211649
public void run() {
		if (logger.isDebugEnabled()){
    		logger.debug("run");
    	}
		
		final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(key.getApplicationName());
		if(sipContext != null) {
			SipManager sipManager = sipContext.getSipManager();
									
			MobicentsSipApplicationSession sipApplicationSession = sipManager.getSipApplicationSession(key, false);
					
			if(sipApplicationSession != null) {				
				ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
				boolean batchStarted = false;
				try {
					if(logger.isDebugEnabled()) {
						logger.debug("Asynchronous work for sip app session " + key + " scheduled to run once the sipappsession lock is available.");
					}
					sipContext.enterSipContext();	
					sipContext.enterSipApp(sipApplicationSession, null, false, true);
					batchStarted = sipContext.enterSipAppHa(true);
					if(logger.isDebugEnabled()) {
						logger.debug("Starting Asynchronous work for sip app session " + key);
					}
					work.doAsynchronousWork(sipApplicationSession);
					if(logger.isDebugEnabled()) {
						logger.debug("Done with Asynchronous work for sip app session " + key);
					}
				} catch(Throwable t) {
					logger.error("An unexpected exception happened in the SipApplicationSessionAsynchronousWork callback on sip application session " + key, t);
				} finally {
					if(logger.isDebugEnabled()) {
						logger.debug("Exiting Asynchronous work for sip app session " + key);
					}
					sipContext.exitSipAppHa(null, null, batchStarted);
					sipContext.exitSipApp(sipApplicationSession, null);
					sipContext.exitSipContext(oldClassLoader);			
				}
			} else {
				if(logger.isDebugEnabled()) {
					logger.debug("SipApplicationSession " + key + " couldn't be found, it may have been already invalidated.");
				}
			}
		}
	}
950189
public void run() {
        Thread currentThread = Thread.currentThread();
        String oldName = currentThread.getName();

        if (newName != null) {
            setName(currentThread, newName);
        }

        try {
            runnable.run();
        } finally {
            setName(currentThread, oldName);
        }
    }
365510
public void run () {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "run");

    //A thread is now processing the queue.
    running = true;

    /*
     *Can't use the running flag here as can allow multiple threads to be running at the same time. For example:
     *
     *Thread 1 is performing run processing, there is nothing left on the queue so it sets running to false.
     *Another thread calls enqueue, running is false so another thread, thread 2 is started.
     *Thread 2 enters the run method and sets running to true.
     *Thread 1 loops round, reads the running flag which is now true so carries on processing. We now get two threads in the run method.
     */
    boolean continueProcessing = true;

    while (continueProcessing) { // Thread should still run
      try {
        //Get invocation but don't dequeue it.
        //Only perform dequeue once invocation has been invoked otherwise a race condition can arise with threads
        //that are dispatching to all non-empty dispatch queues. See defect 538065 for more details.
        final AbstractInvocation invocation = head();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invocation=" + invocation);

        final Dispatchable dispatchable = invocation.getDispatchable();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "dispatchable="+ dispatchable);

        //Whether the invocation should be repooled after it has been invoked.
        boolean repoolInvocation = false;

        //Need to be got when holding lock on invocation.
        final int size;
        final Conversation.ConversationType conversationType;

        // Synchronize on the item as it may have been dispatched to all queues, in
        // which case we do not want to risk corrupting its reference count.
        synchronized (invocation) {
          invocation.decrementReferenceCount();

          // If this this the last thread to 'see' the invocation - and it is ready (ie. the thread that
          // queued it is no longer considering invoking it) then invoke the method represented by the
          // invocation object.
          if (invocation.getReferenceCount() == 0 && invocation.isReady()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Invoking: "+ invocation);

            invocation.invoke();

            final ConversationImpl convImpl = (ConversationImpl)invocation.getConversation();
            synchronized (convImpl.getTotalOutstandingRequestCountLock()) {
              convImpl.decrementTotalOutstandingCount();

              // Check to see if we have processed all outstanding invocation requests
              // for the conversation.  If so, deliver any errors to the SIConnections
              // event listener.  This prevents error delivery preceeding responses to
              // API calls that might have generated the error.
              if (convImpl.getTotalOutstandingRequestCount() == 0) {
                final AbstractInvocation errorInvoc = convImpl.getErrorOccurredInvocation();
                if (errorInvoc != null) {
                  errorInvoc.invoke();
                  errorInvoc.repool();
                  convImpl.setErrorOccurredInvocation(null);
                }
              }
            }

            //Now that invocation has been invoked, repool it.
            repoolInvocation = true;
          } else {
            //AbstractInvocation.toString includes refCount and ready flag information so no need for extra information.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Not invoking " + invocation + " at this time");
          }


          //Need to do this when holding the invocation lock in order to ensure values don't get reset by another
          //thread repooling invocation at the same.
          size = invocation.getSize();

          final Connection connection = invocation.getConnection();
          if (connection != null) {
            conversationType = connection.getConversationType();
          } else {
            conversationType = null;
          }
        }

        //We are now done with invocation, dequeue it regardless of whether we invoked it or not.
        dequeue();

        //Unlock barrier using stashed information.
        unlockBarrier(size, conversationType);

        //All done, repool invocation.
        if(repoolInvocation) invocation.repool();

        // Reduce the conversation's use count for this dispatch queue.
        // If this hits zero then disassociate the conversation from this queue.

        synchronized (dispatchable.getDispatchLockObject()) {
          dispatchable.decrementDispatchQueueRefCount();
          if (dispatchable.getDispatchQueueRefCount() == 0) {
            dispatchable.setDispatchQueue(null);
          }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dispatchable refCount = " + dispatchable.getDispatchQueueRefCount());

        // The queue may now be empty but to ensure correct synchronisation with enqueue synchronise on this object

        synchronized (this) {
          if (isEmpty()) {
            if (emptyDispatchQueues != null) {
              synchronized (emptyDispatchQueues) {
                emptyDispatchQueues.add(this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Added this queue (" + this + ") to empty dispatch list ("+emptyDispatchQueues+")");
              }
            }

            // Sleep for a few seconds to see if more work comes in. This is done to avoid the contention on the WAS
            // threadpool that backs the dispatch queues.

            try {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Thread waiting " + rldThreadRepoolDelay + "ms for new work to arrive");
              wait(rldThreadRepoolDelay);
            } catch (InterruptedException e) {
              // No FFDC Code Needed
            }

            //Do we need to continue processing?
            continueProcessing = !isEmpty();

            // If we are to continue processing remove ourselves from the emptyDispatchQueues list
            if (continueProcessing) {
              if (emptyDispatchQueues != null) {
                synchronized (emptyDispatchQueues) {
                  emptyDispatchQueues.remove(this);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Removed this queue (" + this + ") from empty dispatch list ("+emptyDispatchQueues+")");
                }
              }
            }

            //Indicate whether a new thread needs to be started to process future work.
            running = continueProcessing;
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "continue running thread="+continueProcessing);
        }
      } catch(Throwable e) {
        FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ReceiveListenerDispatchQueue.run", JFapChannelConstants.RLDISPATCHQUEUE_RUN_01, this);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "ReceiveListenerDispatchQueue thread caught exception: ", e);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, e);
      }
    } // while (continueProcessing)

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "run");
  }
906737
public void run() {
    this.runnerState = JobControl.RUNNING;
    while (true) {
      while (this.runnerState == JobControl.SUSPENDED) {
        try {
          Thread.sleep(5000);
        }
        catch (Exception e) {
					
        }
      }
      checkRunningJobs();	
      checkWaitingJobs();		
      startReadyJobs();		
      if (this.runnerState != JobControl.RUNNING && 
          this.runnerState != JobControl.SUSPENDED) {
        break;
      }
      try {
        Thread.sleep(5000);
      }
      catch (Exception e) {
				
      }
      if (this.runnerState != JobControl.RUNNING && 
          this.runnerState != JobControl.SUSPENDED) {
        break;
      }
    }
    this.runnerState = JobControl.STOPPED;
  }
706076
@Override
    public Thread newThread(final Runnable runnable) {
        Runnable wrapped = new Runnable() {
            @Override
            public void run() {
                try {
                    // As the runnable is wrapped in another runnable object, we call the run method directly.
                    runnable.run();     //NOSONAR
                } catch (Exception e) {  //NOSONAR
                    // Catching exception is acceptable here as the wrapped runnable can throw almost anything.
                    log.error("Error while executing " + Thread.currentThread().getName(), e);
                }
            }
        };
        Thread thread = factory.newThread(wrapped);
        thread.setName(prefix + "-" + thread.getName());
        return thread;
    }
57708
@Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        super.subjectRepository.createSubject(this.subject, new SubjectRepository.SubjectUseCase() {
            @Override
            public void onMissionAccomplished(final Subject subject) {
                CreateSubjectUseCaseImp.super.mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onMissionAccomplished(subject);
                    }
                });
            }

            @Override
            public void onError(final SubjectException subjectException) {
                CreateSubjectUseCaseImp.super.mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onError(subjectException);
                    }
                });
            }
        });
    }
28446
public void runnable(Runnable runnable) {
		initStartTotal();
		long startInvokation = System.currentTimeMillis();
		runnable.run();
		invoked(System.currentTimeMillis() - startInvokation);
	}
1339464
@Override
    public void run() {
        if (!mDone) {
            synchronized (this) {
                if (!mDone) {
                    call();
                    mDone = true;
                    try {
                        this.notifyAll();
                    } catch (Exception ignored) {
                    }
                }
            }
        }
    }