Starts the thread to index a single resource.<p>

@see java.lang.Runnable#run()
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()));
                }
            }
        }
    }
76441
@Override
    public synchronized void run() {

        try {
            // do the rename operation
            m_elementRename.actionRename(getReport());
        } catch (Exception e) {
            getReport().println(e);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getMessage());
            }
        }
    }
293979
public void startup() {
        if (isRunning) return;

        Executors.getInstance().execute(new Runnable() {
            @Override
            public void run() {
                DispatcherHandler handler = new DispatcherHandler(AndServer.getContext());
                ComponentRegister register = new ComponentRegister(AndServer.getContext());
                register.register(handler, mGroup);

                mHttpServer = ServerBootstrap.bootstrap()
                    .setSocketConfig(SocketConfig.custom()
                        .setSoKeepAlive(true)
                        .setSoReuseAddress(true)
                        .setSoTimeout(mTimeout)
                        .setTcpNoDelay(true)
                        .build())
                    .setConnectionConfig(
                        ConnectionConfig.custom().setBufferSize(4 * 1024).setCharset(Charsets.UTF_8).build())
                    .setLocalAddress(mInetAddress)
                    .setListenerPort(mPort)
                    .setSslContext(mSSLContext)
                    .setSslSetupHandler(new SSLInitializerWrapper(mSSLInitializer))
                    .setServerInfo("AndServer/2.0.0")
                    .registerHandler("*", handler)
                    .setExceptionLogger(ExceptionLogger.NO_OP)
                    .create();
                try {
                    isRunning = true;
                    mHttpServer.start();

                    Executors.getInstance().post(new Runnable() {
                        @Override
                        public void run() {
                            if (mListener != null) mListener.onStarted();
                        }
                    });
                    Runtime.getRuntime().addShutdownHook(new Thread() {
                        @Override
                        public void run() {
                            mHttpServer.shutdown(3, TimeUnit.SECONDS);
                        }
                    });
                } catch (final Exception e) {
                    Executors.getInstance().post(new Runnable() {
                        @Override
                        public void run() {
                            if (mListener != null) mListener.onException(e);
                        }
                    });
                }
            }
        });
    }
833773
@Override
	public void run() {
		try {
			while (running && (monitored == null || !monitored.isDone())) {
				logger.info(getMemoryUsageStatsAsString(memoryBean));
				logger.info(getDirectMemoryStatsAsString(directBufferBean));
				logger.info(getMemoryPoolStatsAsString(poolBeans));
				logger.info(getGarbageCollectorStatsAsString(gcBeans));
				
				try {
					Thread.sleep(interval);
				}
				catch (InterruptedException e) {
					if (running) {
						throw e;
					}
				}
			}
		}
		catch (Throwable t) {
			logger.error("Memory logger terminated with exception", t);
		}
	}
1339464
@Override
    public void run() {
        if (!mDone) {
            synchronized (this) {
                if (!mDone) {
                    call();
                    mDone = true;
                    try {
                        this.notifyAll();
                    } catch (Exception ignored) {
                    }
                }
            }
        }
    }
510436
public void run() {
        try {
            while (--expires >= 0) {
                sleep(sysInterval);
                synchronized (ThreadClockImpl.class) {
                    currentTimeMillis += sysInterval;
                }
            }
        } catch (InterruptedException e) {
            System.out.println("Clock thread interrupted");
        }
    }
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);
                    }
                });
            }
        });
    }
219035
@Override
    public void run() {

        getReport().println(
            Messages.get().container(Messages.RPT_REBUILD_SEARCH_INDEXES_BEGIN_0),
            I_CmsReport.FORMAT_HEADLINE);

        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put(I_CmsEventListener.KEY_REPORT, getReport());
            if (m_indexNames != null) {
                params.put(I_CmsEventListener.KEY_INDEX_NAMES, CmsStringUtil.collectionAsString(m_indexNames, ","));
            }
            OpenCms.fireCmsEvent(I_CmsEventListener.EVENT_REBUILD_SEARCHINDEXES, params);
            getReport().println(
                Messages.get().container(Messages.RPT_REBUILD_SEARCH_INDEXES_END_0),
                I_CmsReport.FORMAT_HEADLINE);
        } catch (Throwable exc) {
            getReport().println(
                org.opencms.search.Messages.get().container(org.opencms.search.Messages.RPT_SEARCH_INDEXING_FAILED_0),
                I_CmsReport.FORMAT_WARNING);
            getReport().println(exc);
            m_error = exc;
        }
    }
99671
public void run() {
        while (true) {
            Object obj;
            try {
                obj = messages.take();
                notifySubscribers(obj);
            } catch (InterruptedException e) {
                // restore interrupted status
                Thread.currentThread().interrupt();
            }
        }
    }
360123
@Override
    public void run() {

        try {
            Thread.sleep(WATCHER_INTERVAL);
        } catch (InterruptedException e) {
            LOG.error(Messages.get().container(Messages.ERR_UPLOAD_INTERRUPT_WATCH_DOG_1, m_listener.toString()), e);
        }
        if (m_listener != null) {
            if (((m_listener.getBytesRead() > 0) && (m_listener.getPercent() >= 100)) || m_listener.isCanceled()) {
                LOG.debug(Messages.get().container(Messages.LOG_UPLOAD_FINISHED_WATCHER_1, m_listener.toString()));
                m_listener = null;
            } else {
                if (isFrozen()) {
                    m_listener.cancelUpload(new CmsUploadException(
                        Messages.get().getBundle().key(
                            Messages.ERR_UPLOAD_FROZEN_1,
                            new Integer(CmsUploadBean.DEFAULT_UPLOAD_TIMEOUT / 1000))));
                } else {
                    run();
                }
            }
        }
    }
166971
@Override
	public void run()
	{
		try
		{
			String serverHost = InetUtils.resolveAutoInterfaceAddress(settings.getStringProperty(FFMQJMXConsoleSettings.SERVER_HOST, "localhost"));
			int serverPort = settings.getIntProperty(FFMQJMXConsoleSettings.SERVER_PORT, 10003);

			String serviceUrl = "service:jmx:rmi://"+serverHost+"/jndi/rmi://"+serverHost+":"+serverPort+"/jmxconnector-FFMQ-server";
			out.println("JMX Service URL : "+serviceUrl);
			this.jmxServiceURL = new JMXServiceURL(serviceUrl);

			printServerVersion();
			
			boolean interactive = settings.getBooleanProperty(FFMQJMXConsoleSettings.INTERACTIVE, false);
			if (interactive)
				interactiveMode();
			else
			{
				String command = settings.getStringProperty(FFMQJMXConsoleSettings.COMMAND, "help");
				processCommand(command);
			}
		}
		catch (Exception e)
		{
			closeJMXResources();
			handleException(e);
		}
	}
445754
@Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                jobCounter.addAndGet(service.executeScheduledAlerts(50, timeout).size());
                LOGGER.info("alerts evaluated so far: {}", jobCounter.get()); 
                Thread.sleep(POLL_INTERVAL_MS);
            } catch (InterruptedException ex) {
                LOGGER.info("Execution was interrupted.");
                Thread.currentThread().interrupt();
                break;
            } catch (Throwable ex) {
                LOGGER.error("Exception in alerter: {}", ExceptionUtils.getFullStackTrace(ex));
            }
        }
        LOGGER.warn(MessageFormat.format("Alerter thread interrupted. {} alerts evaluated by this thread.", jobCounter.get()));
        service.dispose();
    }
1143966
public void run()
   {
      this.currentThread = Thread.currentThread();
      this.running.set(true);

      while (this.running.get())
      {
         Task nextTask = null;
         try
         {
            if (_logger.isDebugEnabled())
               _logger.debug("Waiting for next task...");
            nextTask = this.taskSet.take();
            if (_logger.isDebugEnabled())
               _logger.debug("next from taskset is task: " + nextTask.getCommand());
            this.executor.submit(nextTask);
            if (_logger.isDebugEnabled())
               _logger.debug("submitted for execution command: " + nextTask.getCommand());
         }
         catch (InterruptedException e)
         {
            _logger.debug("Task manager thread interrupted.");
            this.running.set(false);
         }
         catch (Exception e)
         {
            _logger.debug("Task manager experienced an unhandled exception, shutting down");
            this.running.set(false);
         }
      }
      _logger.info("Shutting down task manager.");

      this.taskSet.clear();
      executor.shutdown();
   }
1137685
@Override
  public void run()
  {
    try {
      while (! isClosed() && _is.read() > 0 && _in.readMessage(_is)) {
        ServiceRef.flushOutbox();
      }
    } catch (EOFException e) {
      log.finer(this + " end of file");
      
      if (log.isLoggable(Level.ALL)) {
        log.log(Level.ALL, e.toString(), e);
      }
    } catch (SocketException e) {
      e.printStackTrace();
      log.finer(this + " socket closed:" + e);
      
      if (log.isLoggable(Level.ALL)) {
        log.log(Level.ALL, e.toString(), e);
      }
    } catch (IOException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    } catch (Throwable e) {
      e.printStackTrace();
      throw e;
    } finally {
      close();
    }
  }
662671
@Override
    public synchronized void start() {
        if (!started.getAndSet(true)) {
            finished.set(false);
            thread.start();
        }
    }
531007
@Override
	final public void run() {
		while(true) {
			try {
				try {
					sleep(delayTime);
				} catch(InterruptedException err) {
					logger.log(Level.WARNING, null, err);
				}
				long time = System.currentTimeMillis();
				List<C> connsToClose;
				synchronized(poolLock) {
					if(isClosed) return;
					// Find any connections that are available and been idle too long
					int maxIdle = maxIdleTime;
					connsToClose = new ArrayList<>(availableConnections.size());
					for(PooledConnection<C> availableConnection : availableConnections) {
						synchronized(availableConnection) {
							C conn = availableConnection.connection;
							if(conn!=null) {
								if(
									(time-availableConnection.releaseTime) > maxIdle // Idle too long
									|| (
										maxConnectionAge!=UNLIMITED_MAX_CONNECTION_AGE
										&& (
											availableConnection.createTime > time // System time reset?
											|| (time-availableConnection.createTime) >= maxConnectionAge // Max connection age reached
										)
									)
								) {
									availableConnection.connection = null;
									connsToClose.add(conn);
								}
							}
						}
					}
				}
				// Close all of the connections
				for(C conn : connsToClose) {
					try {
						close(conn);
					} catch(Exception err) {
						logger.log(Level.WARNING, null, err);
					}
				}
			} catch (ThreadDeath TD) {
				throw TD;
			} catch (Throwable T) {
				logger.logp(Level.SEVERE, AOPool.class.getName(), "run", null, T);
			}
		}
	}
340072
@Override
  public void run() {
    // Workaround for Issue #4 (http://code.google.com/p/jdiameter/issues/detail?id=4)
    // BEGIN WORKAROUND // Give some time to initialization...
    int sleepTime = 250;
    logger.debug("Sleeping for {}ms before starting transport so that listeners can all be added and ready for messages", sleepTime);
    try {
      Thread.sleep(sleepTime);
    }
    catch (InterruptedException e) {
      // ignore
    }
    logger.debug("Finished sleeping for {}ms. By now, MutablePeerTableImpl should have added its listener", sleepTime);

    logger.debug("Transport is started. Socket is [{}]", socketDescription);
    Selector selector = null;
    try {
      selector = Selector.open();
      socketChannel.register(selector, SelectionKey.OP_READ);
      while (!stop) {
        selector.select(SELECT_TIMEOUT);
        Iterator<SelectionKey> it = selector.selectedKeys().iterator();
        while (it.hasNext()) {
          // Get the selection key
          SelectionKey selKey = it.next();
          // Remove it from the list to indicate that it is being processed
          it.remove();
          if (selKey.isValid() && selKey.isReadable()) {
            // Get channel with bytes to read
            SocketChannel sChannel = (SocketChannel) selKey.channel();
            int dataLength = sChannel.read(buffer);
            logger.debug("Just read [{}] bytes on [{}]", dataLength, socketDescription);
            if (dataLength == -1) {
              stop = true;
              break;
            }
            buffer.flip();
            byte[] data = new byte[buffer.limit()];
            buffer.get(data);
            append(data);
            buffer.clear();
          }
        }
      }
    }
    catch (ClosedByInterruptException e) {
      logger.error("Transport exception ", e);
    }
    catch (AsynchronousCloseException e) {
      logger.error("Transport is closed");
    }
    catch (Throwable e) {
      logger.error("Transport exception ", e);
    }
    finally {
      try {
        clearBuffer();
        if (selector != null) {
          selector.close();
        }
        if (socketChannel != null && socketChannel.isOpen()) {
          socketChannel.close();
        }
        getParent().onDisconnect();
      }
      catch (Exception e) {
        logger.error("Error", e);
      }
      stop = false;
      logger.info("Read thread is stopped for socket [{}]", socketDescription);
    }
  }