/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** * This will verify if the executor is flushed with no wait (or very minimal wait if not the {@link org.apache.activemq.artemis.utils.actors.OrderedExecutor} * @return */ default boolean isFlushed() { CountDownLatch latch = new CountDownLatch(1); Runnable runnable = new Runnable() { @Override public void run() { latch.countDown(); } }; execute(runnable); try { return latch.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return false; } }
@Override public void afterCommit(final Transaction tx1) { executor.execute(new Runnable() { @Override public void run() { if (!completeDelete) { cursorProvider.scheduleCleanup(); } } }); } });
@Override public void execute(Runnable command) { executor.execute(command); } }
public void runOnPool(Runnable runnable) { poolExecutor.execute(runnable); }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** To be used to flush an executor from a different thread. * WARNING: Do not call this within the executor. That would be stoopid ;) * * @param timeout * @param unit * @return */ default boolean flush(long timeout, TimeUnit unit) { CountDownLatch latch = new CountDownLatch(1); execute(latch::countDown); try { return latch.await(timeout, unit); } catch (Exception e) { return false; } }
/** * This will verify if the executor is flushed with no wait (or very minimal wait if not the {@link org.apache.activemq.artemis.utils.actors.OrderedExecutor} * @return */ default boolean isFlushed() { CountDownLatch latch = new CountDownLatch(1); Runnable runnable = new Runnable() { @Override public void run() { latch.countDown(); } }; execute(runnable); try { return latch.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return false; } }
/** * This will verify if the executor is flushed with no wait (or very minimal wait if not the {@link org.apache.activemq.artemis.utils.actors.OrderedExecutor} * @return */ default boolean isFlushed() { CountDownLatch latch = new CountDownLatch(1); Runnable runnable = new Runnable() { @Override public void run() { latch.countDown(); } }; execute(runnable); try { return latch.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return false; } }
public boolean checkReleaseMemory(boolean globalOversized, long newSize) { if (!globalOversized && (newSize <= maxSize || maxSize < 0)) { if (!onMemoryFreedRunnables.isEmpty()) { executor.execute(this::memoryReleased); if (blocking.get()) { ActiveMQServerLogger.LOGGER.unblockingMessageProduction(address, sizeInBytes.get(), maxSize); blocking.set(false); return true; } } } return false; }
@Override public void expireReferences() { if (isExpirationRedundant()) { return; } if (!queueDestroyed && expiryScanner.scannerRunning.get() == 0) { expiryScanner.scannerRunning.incrementAndGet(); getExecutor().execute(expiryScanner); } }
@Override public void deliverAsync() { if (scheduledRunners.get() < MAX_SCHEDULED_RUNNERS) { scheduledRunners.incrementAndGet(); try { getExecutor().execute(deliverRunner); } catch (RejectedExecutionException ignored) { // no-op scheduledRunners.decrementAndGet(); } checkDepage(); } }
private void scheduleDepage(final boolean scheduleExpiry) { if (!depagePending) { if (logger.isTraceEnabled()) { logger.trace("Scheduling depage for queue " + this.getName()); } depagePending = true; pageSubscription.getExecutor().execute(new DepageRunner(scheduleExpiry)); } }
@Override public void close() throws Exception { getExecutor().execute(new Runnable() { @Override public void run() { try { cancelRedistributor(); } catch (Exception e) { // nothing that could be done anyway.. just logging ActiveMQServerLogger.LOGGER.unableToCancelRedistributor(e); } } }); if (addressSettingsRepository != null) { addressSettingsRepository.unRegisterListener(addressSettingsRepositoryListener); } }
public int transferConnection(final CoreRemotingConnection newConnection, final int lastReceivedCommandID) { SimpleFuture<Integer> future = new SimpleFutureImpl<>(); callExecutor.execute(() -> { int value = internaltransferConnection(newConnection, lastReceivedCommandID); future.set(value); }); try { return future.get().intValue(); } catch (Exception e) { throw new IllegalStateException(e); } }
@Override public void flushExecutors() { cursorProvider.flushExecutors(); FutureLatch future = new FutureLatch(); executor.execute(future); if (!future.await(60000)) { ActiveMQServerLogger.LOGGER.pageStoreTimeout(address); } }