code: protected Runnable getNextRunnable() throws InterruptedException {
  
          Runnable toRun = null;
  
          // Wait for new Runnable (see runInThread()) and notify runInThread()
          // in case the next Runnable is already waiting.
          synchronized (m_nextRunnableLock) {
              if (m_nextRunnable == null) {
                  m_nextRunnableLock.wait(1000);
              }
  
              if (m_nextRunnable != null) {
                  toRun = m_nextRunnable;
                  m_nextRunnable = null;
                  m_nextRunnableLock.notifyAll();
              }
          }
  
          return toRun;
      }
docs: Dequeue the next pending <code>Runnable</code>.<p>
  
  @return the next pending <code>Runnable</code>
  @throws InterruptedException if something goes wrong