public void execute(final PrioritizableRunnable runnable) {
    _queue.add(runnable);
    // Guarantees that execution loop is scheduled only once to the underlying executor.
    // Also makes sure that all memory effects of last Runnable are visible to the next Runnable
    // in case value returned by decrementAndGet == 0.
    if (_pendingCount.getAndIncrement() == 0) {
      tryExecuteLoop();
    }
  }
@Test(dataProvider = "draining")
  public void testExecuteTwoStepPlan(boolean draining) throws InterruptedException {
    final LatchedRunnable inner = new LatchedRunnable();

    final Runnable outer = new Runnable() {
      @Override
      public void run() {
        _serialExecutor.execute(inner);
      }
    };

    _executorService.execute(outer);
    assertTrue(inner.await(5, TimeUnit.SECONDS));
    assertFalse(_rejectionHandler.wasExecuted());
    assertTrue(_capturingDeactivationListener.await(5, TimeUnit.SECONDS));
    assertEquals(_capturingDeactivationListener.getDeactivatedCount(), 1);
  }