code: public boolean runInThread(Runnable runnable) {
  
          if (runnable == null) {
              return false;
          }
  
          if (m_isShutdown) {
              LOG.debug(Messages.get().getBundle().key(Messages.LOG_THREAD_POOL_UNAVAILABLE_0));
              return false;
          }
  
          boolean hasNextRunnable;
          synchronized (m_nextRunnableLock) {
              // must synchronize here to avoid potential double checked locking
              hasNextRunnable = (m_nextRunnable != null);
          }
  
          if (hasNextRunnable || (m_currentThreadCount == 0)) {
              // try to grow the thread pool since other runnables are already waiting
              growThreadPool();
          }
  
          synchronized (m_nextRunnableLock) {
  
              // wait until a worker thread has taken the previous Runnable
              // or until the thread pool is asked to shutdown
              while ((m_nextRunnable != null) && !m_isShutdown) {
                  try {
                      m_nextRunnableLock.wait(1000);
                  } catch (InterruptedException e) {
                      // can be ignores
                  }
              }
  
              // during normal operation, not shutdown, set the nextRunnable
              // and notify the worker threads waiting (getNextRunnable())
              if (!m_isShutdown) {
                  m_nextRunnable = runnable;
                  m_nextRunnableLock.notifyAll();
              }
          }
  
          // if the thread pool is going down, execute the Runnable
          // within a new additional worker thread (no thread from the pool)
          // note: the synchronized section should be as short (time) as
          // possible as starting a new thread is not a quick action
          if (m_isShutdown) {
              CmsSchedulerThread thread = new CmsSchedulerThread(
                  this,
                  m_threadGroup,
                  m_threadNamePrefix + "(final)",
                  m_threadPriority,
                  false,
                  runnable);
              thread.start();
          }
  
          return true;
      }
docs: Run the given <code>Runnable</code> object in the next available
  <code>Thread</code>.<p>
  
  If while waiting the thread pool is asked to
  shut down, the Runnable is executed immediately within a new additional
  thread.<p>
  
  @param runnable the <code>Runnable</code> to run
  @return true if the <code>Runnable</code> was run