@Override
  public void flushExecutors() {
    cursorProvider.flushExecutors();

    FutureLatch future = new FutureLatch();

    executor.execute(future);

    if (!future.await(60000)) {
      ActiveMQServerLogger.LOGGER.pageStoreTimeout(address);
    }
  }
  @Override
  public void flushExecutor() {
    // Wait for any create objects runnable to complete
    FutureLatch future = new FutureLatch();

    executor.execute(future);

    boolean ok = future.await(10000);

    if (!ok) {
      ActiveMQServerLogger.LOGGER.timedOutWaitingToStopBridge();
    }
  }
  private void waitForOnMessageToComplete(boolean waitForOnMessage) {
    if (handler == null) {
      return;
    }

    if (!waitForOnMessage || Thread.currentThread() == onMessageThread) {
      // If called from inside onMessage then return immediately - otherwise would block
      return;
    }

    FutureLatch future = new FutureLatch();

    sessionExecutor.execute(future);

    boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS);

    if (!ok) {
      ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing();
    }
  }