public void flushExecutor() {
   FutureLatch future = new FutureLatch();
   executor.execute(future);
   if (!future.await(10000)) {
     server.threadDump("Couldn't finish executor on " + this);
   }
 }
  public void setTransferring(final boolean transferring) {
    synchronized (lock) {
      // This is to make sure that the delivery process has finished any pending delivery
      // otherwise a message may sneak in on the client while we are trying to stop the consumer
      lockDelivery.writeLock().lock();
      try {
        this.transferring = transferring;
      } finally {
        lockDelivery.writeLock().unlock();
      }
    }

    // Outside the lock
    if (transferring) {
      // And we must wait for any force delivery to be executed - this is executed async so we add a
      // future to the
      // executor and
      // wait for it to complete

      FutureLatch future = new FutureLatch();

      messageQueue.getExecutor().execute(future);

      boolean ok = future.await(10000);

      if (!ok) {
        HornetQServerLogger.LOGGER.errorTransferringConsumer();
      }
    }

    if (!transferring) {
      promptDelivery();
    }
  }
  private void waitForFuture() {
    FutureLatch future = new FutureLatch();

    executor.execute(future);

    while (!future.await(10000)) {
      HornetQServerLogger.LOGGER.timedOutStoppingPagingCursor(future, executor);
    }
  }
Beispiel #4
0
 public void flushExecutor() {
   FutureLatch future = new FutureLatch();
   executor.execute(future);
   if (!future.await(10000)) {
     server.threadDump(
         "Couldn't flush ClusterManager executor ("
             + this
             + ") in 10 seconds, verify your thread pool size");
   }
 }