run method declaration <P>

the trigger JSP is run in its own thread here. Its job is simply to
wait until it is told by the main thread that it should fire the
trigger.
515462
public void run() {

        while (keepGoing) {
            TriggerData triggerData = popPair();

            if (triggerData != null) {
                if (triggerData.username != null) {
                    trigger.fire(this.vectorIndex, name.name,
                                 table.getName().name, triggerData.oldRow,
                                 triggerData.newRow);
                }
            }
        }
    }
327922
@Override
    @SuppressWarnings({ "PMD.EmptySynchronizedBlock", "PMD.EmptyCatchBlock",
        "PMD.AvoidCatchingThrowable" })
    public void run() {
        try {
            registerAsGenerator();
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    selector.select();
                    Set<SelectionKey> selected = selector.selectedKeys();
                    for (SelectionKey key : selected) {
                        ((NioHandler) key.attachment())
                            .handleOps(key.readyOps());
                    }
                    selected.clear();
                    synchronized (selectorGate) {
                        // Delay next iteration if another thread has the lock.
                        // "Find bugs" complains, but this is really okay.
                    }
                } catch (InterruptedIOException | InterruptedException
                        | Error e) {
                    break;
                } catch (Throwable e) {
                    // Ignore anything else, this loop is crucial.
                }
            }
        } finally {
            unregisterAsGenerator();
        }
    }
640930
def execute
      @thread = Thread.new do
        if Thread.current != Thread.main
          loop do
            @datasource.monitor.on_trigger do
              @datasource.action.activate(@datasource.action_options)
            end
          end
        end
      end
    end
1062824
@Override
    public synchronized void run() {

        try {
            // do the rename operation
            m_mergePages.actionMerge(getReport());
        } catch (Exception e) {
            getReport().println(e);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage());
            }
        }
    }
967375
@Override
    public void run() {

        // flag for logging in the "final" block
        boolean docOk = false;
        try {

            // create the index document
            m_result = createIndexDocument(m_cms, m_res, m_index, m_count, m_report);
            docOk = true;

            // check if the thread was interrupted
            if (isInterrupted() && LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(Messages.LOG_ABANDONED_THREAD_FINISHED_1, m_res.getRootPath()));
            }

        } catch (CmsIndexNoContentException e) {
            // Ignore exception caused by empty documents, so that the report is not messed up with error message
            m_report.println(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                I_CmsReport.FORMAT_OK);
        } catch (Throwable exc) {
            if (m_report != null) {
                m_report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                    I_CmsReport.FORMAT_ERROR);
                m_report.println(
                    org.opencms.report.Messages.get().container(
                        org.opencms.report.Messages.RPT_ARGUMENT_1,
                        exc.toString()),
                    I_CmsReport.FORMAT_ERROR);
            }
            if (LOG.isErrorEnabled()) {
                LOG.error(
                    Messages.get().getBundle().key(
                        Messages.ERR_INDEX_RESOURCE_FAILED_2,
                        m_res.getRootPath(),
                        m_index.getName()),
                    exc);
            }
            // set flag to avoid logging in finally block
            docOk = true;
        } finally {
            if (!docOk) {
                // apparently there was a Throwable that causes an issue
                if (m_report != null) {
                    m_report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                        I_CmsReport.FORMAT_ERROR);
                    m_report.println(
                        Messages.get().container(
                            Messages.ERR_INDEX_RESOURCE_FAILED_2,
                            m_res.getRootPath(),
                            m_index.getName()),
                        I_CmsReport.FORMAT_ERROR);
                }
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_INDEX_RESOURCE_FAILED_2,
                            m_res.getRootPath(),
                            m_index.getName()));
                }
            }
        }
    }
887873
@Override
    public void run() {

        try {
            // do the import
            m_htmlImport.startImport(getReport());
        } catch (Exception e) {
            getReport().println(e);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage());
            }
        }
    }
1326182
public void runPageLoader()
    {
            SwingUtilities.invokeLater(new Thread()
            {	// Utility class to change the status in the AWT thread, then run the m_swingPageLoader.
            	public void run()
            	{
                    if (m_syncPage instanceof Task)
                    {
                        String strWaitMessage = WAIT_MESSAGE;
                        try {
                            strWaitMessage = ((Task)m_syncPage).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage);
                        } catch (MissingResourceException ex) {
                        }
                        ((Task)m_syncPage).setStatusText(strWaitMessage, Constants.WAIT);
                    }
                    else if (m_syncPage instanceof JBasePanel)
                    {
                        if (((JBasePanel)m_syncPage).getBaseApplet() != null)
                        {
                            String strWaitMessage = WAIT_MESSAGE;
                            try {
                                strWaitMessage = (((JBasePanel)m_syncPage).getBaseApplet()).getApplication().getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(strWaitMessage);
                            } catch (MissingResourceException ex) {
                            }
                            ((JBasePanel)m_syncPage).getBaseApplet().setStatusText(strWaitMessage, Constants.WAIT);
                        }
                    }
                    Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
                    if (m_syncPage instanceof Component)
                    {
                    	((Component)m_syncPage).setCursor(waitCursor);
                        ((Component)m_syncPage).repaint();	// Queue a repaint
                    }
                    
                    if (m_swingPageLoader != null)
                    	m_swingPageLoader.run();
            		
                    if (m_syncPage instanceof Component)
                        ((Component)m_syncPage).repaint();                    
            	}
            });
    }
1339464
@Override
    public void run() {
        if (!mDone) {
            synchronized (this) {
                if (!mDone) {
                    call();
                    mDone = true;
                    try {
                        this.notifyAll();
                    } catch (Exception ignored) {
                    }
                }
            }
        }
    }
1152994
@Override
    public void run() {
        synchronized (this) {
            // Save current event pipeline and currently handled event
            // because a SynchronousEventPipeline can be called while
            // handling an event (from another event processor).
            InternalEventPipeline currentPipeline = FeedBackPipelineFilter
                .getAssociatedPipeline();
            EventBase<?> currentEvent = newEventsParent.get();
            try {
                super.run();
            } finally {
                newEventsParent.set(currentEvent);
                FeedBackPipelineFilter.setAssociatedPipeline(currentPipeline);
            }
        }
    }
601469
public void run(){
      switch(mode){
        case START_MODE:
         try{
           startSession();
         }catch(IOException ioe){
           handleException(ioe);
           //ioe.printStackTrace();
         }finally{
           abort();
           if(auth!=null) auth.endSession();
           log("Main thread(client->remote)stopped.");
         }
        break;
        case ACCEPT_MODE:
          try{
            doAccept();
            mode = PIPE_MODE;
            pipe_thread1.interrupt(); //Tell other thread that connection have
                                      //been accepted.
            pipe(remote_in,out);
          }catch(IOException ioe){
            //log("Accept exception:"+ioe);
            handleException(ioe);
          }finally{
            abort();
            log("Accept thread(remote->client) stopped");
          }
        break;
        case PIPE_MODE:
         try{
            pipe(remote_in,out);
         }catch(IOException ioe){
         }finally{
            abort();
            log("Support thread(remote->client) stopped");
         }
        break;
        case ABORT_MODE:
        break;
        default:
         log("Unexpected MODE "+mode);
      }
   }
1086472
@Override
  @SuppressWarnings("unchecked")
  public void run() {
    while (!this.shutdown) {
      try {
        this.lastThreadCheckTime = System.currentTimeMillis();
        this.updater.updateExecutions();
        // TODO not sure why it would be important to check the status immediately in case of _new_
        // executions. This can only optimize finalizing executions that finish super-quickly after
        // being started.
        waitForNewExecutions();
      } catch (final Exception e) {
        logger.error("Unexpected exception in updating executions", e);
      }
    }
  }
675934
@Override
	final public void run() {
		try {
			if(args.length>0) handleCommand(args);
			else runImpl();
			status="Done";
		} catch(IOException exception) {
			this.err.println(getName()+": "+exception.getMessage());
			status="IO Error: "+exception.getMessage();
			this.err.flush();
		} catch(SQLException exception) {
			this.err.println(getName()+": "+exception.getMessage());
			status="SQL Error: "+exception.getMessage();
			this.err.flush();
		} catch(ThreadDeath TD) {
			throw TD;
		} catch(Throwable T) {
			ErrorPrinter.printStackTraces(T, this.err);
			status="Error: "+T.toString();
			this.err.flush();
		} finally {
			if(Thread.currentThread()==thread) thread=null;
		}
	}
1338633
@Override
	public final void run() {

		LOGGER.debug("Executing " + getClass().getSimpleName());
		markAsInProgress();

		if (!Lists.isNullOrEmpty(listeners)) {
			Runnable startUseCaseRunnable = new Runnable() {
				@Override
				public void run() {
					for (UseCaseListener listener : listeners) {
						notifyUseCaseStart(listener);
					}
				}
			};
			if (handler != null) {
				handler.post(startUseCaseRunnable);
			} else {
				startUseCaseRunnable.run();
			}
		}

		Trace trace = null;
		if (timingTrackingEnabled()) {
			trace = TraceHelper.startTrace(getClass());
		}

		try {

			LOGGER.debug("Started " + getClass().getSimpleName());
			executionTime = null;
			startTime = DateUtils.nowMillis();
			doExecute();
			executionTime = DateUtils.nowMillis() - startTime;
			LOGGER.debug("Finished " + getClass().getSimpleName() + ". Execution time: " + DateUtils.formatDuration(executionTime));

			if (trace != null) {
				trace.putAttribute("result", "success");
				trace.incrementMetric("successes", 1);
			}

			markAsSuccessful();

			if (!Lists.isNullOrEmpty(listeners)) {
				Runnable finishedUseCaseRunnable = new Runnable() {
					@Override
					public void run() {
						for (UseCaseListener listener : listeners) {
							notifyFinishedUseCase(listener);
						}
						markAsNotified();
					}
				};
				if (handler != null) {
					handler.post(finishedUseCaseRunnable);
				} else {
					finishedUseCaseRunnable.run();
				}
			}

		} catch (RuntimeException e) {
			if (trace != null) {
				trace.putAttribute("result", "failure");
				trace.incrementMetric("failures", 1);
			}
			final AbstractException abstractException = wrapException(e);
			markAsFailed(abstractException);
			logHandledException(abstractException);

			if (!Lists.isNullOrEmpty(listeners)) {
				Runnable finishedFailedUseCaseRunnable = new Runnable() {
					@Override
					public void run() {
						for (UseCaseListener listener : listeners) {
							notifyFailedUseCase(abstractException, listener);
						}
						markAsNotified();
					}
				};
				if (handler != null) {
					handler.post(finishedFailedUseCaseRunnable);
				} else {
					finishedFailedUseCaseRunnable.run();
				}
			}
		} finally {
			if (trace != null) {
				trace.stop();
			}
		}
	}
714105
public void run()
    {
        // Note: To make sure the user gets a chance to see the
        // html text, we wait for a paint before returing.
        // Since these threads are stacked in a private thread queue, the next
        // thread is not executed until this one is finished.
            if (! EventQueue.isDispatchThread() 
)//            && Runtime.getRuntime().availableProcessors() == 1)
        {
            if (!m_syncPage.isPaintCalled())
            {   // Wait for the previous call to finish
                synchronized (m_syncPage) {
                    while (!m_syncPage.isPaintCalled()) {
                        try { m_syncPage.wait(); } catch (InterruptedException e) {}
                    }
                }
            }
            synchronized (m_syncPage) {
                m_syncPage.setPaintCalled(false);

                this.runPageLoader();

                while (!m_syncPage.isPaintCalled()) {
                    try { m_syncPage.wait(); } catch (InterruptedException e) {}
                }
                
                this.afterPageDisplay();
            }
        }
    }
313384
@SuppressWarnings({ "rawtypes", "unchecked" })
	public void run()
	{
		IProcess process = fConsole.getProcess();
		if (process != null)
		{
			List targets = collectTargets(process);
			targets.add(process);
			DebugCommandService service = DebugCommandService.getService(fWindow);
			service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
		}
	}
859217
public void run() {

        while (!stop) {
            long t0 = System.currentTimeMillis();

            try {
                EventConsumer.subscribeIfNotDone();
                resubscribe_if_needed();
            }
            catch (Exception e) {
                e.printStackTrace();
            }
            catch (Error err) {
                err.printStackTrace();
            }

            long msToSleep = EVENT_HEARTBEAT_PERIOD - (System.currentTimeMillis() - t0);
            if (msToSleep<5)
                msToSleep = 5;
            waitNextLoop(msToSleep);
        }
    }
1120734
public void run ()
    {
        log.info("DOMGR running.");

        // make a note of the thread that's processing events
        synchronized (this) {
            _dobjThread = Thread.currentThread();
        }

        while (isRunning()) {
            // pop the next unit off the queue and process it
            processUnit(_evqueue.get());
        }

        log.info("DOMGR exited.");
    }