/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** * Sending an initial credit for slow consumers */ private void startSlowConsumer() { if (logger.isTraceEnabled()) { logger.trace(this + "::Sending 1 credit to start delivering of one message to slow consumer"); } sendCredits(1); try { // We use an executor here to guarantee the messages will arrive in order. // However when starting a slow consumer, we have to guarantee the credit was sent before we can perform any // operations like forceDelivery pendingFlowControl.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // will just ignore and forward the ignored Thread.currentThread().interrupt(); } }
/** * Wait for backup synchronization when using synchronization * * @param timeout * @param unit * @return {@code true} if the server was already initialized or if it was initialized within the * timeout period, {@code false} otherwise. * @throws InterruptedException * @see java.util.concurrent.CountDownLatch#await(long, TimeUnit) */ public boolean waitForBackupSync(long timeout, TimeUnit unit) throws InterruptedException { return backupSyncLatch.await(timeout, unit); }
public boolean await(long timeout, TimeUnit unit) throws Exception { return latch.await(timeout, unit); }
@Override public boolean waitForActivation(long timeout, TimeUnit unit) throws InterruptedException { return activationLatch.await(timeout, unit); }
public void waitCompletion() throws InterruptedException { countLatch.await(); if (errorMessage != null) { throw new IllegalStateException("Error on Transaction: " + errorCode + " - " + errorMessage); } }
private static void flushLatch(ReusableLatch latch) throws InterruptedException, IOException { if (!latch.await(MAX_FLUSH_NANOS, TimeUnit.NANOSECONDS)) { throw new IOException("Timed out on receiving IO callback"); } }
public void waitCompletion() throws InterruptedException { countLatch.await(); if (errorMessage != null) { throw new IllegalStateException("Error on Transaction: " + errorCode + " - " + errorMessage); } }
private static void flushLatch(ReusableLatch latch) throws InterruptedException, IOException { if (!latch.await(MAX_FLUSH_NANOS, TimeUnit.NANOSECONDS)) { throw new IOException("Timed out on receiving IO callback"); } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
/** It will wait all threads to finish */ public boolean join(int timeout, TimeUnit timeUnit) { try { return active.await(timeout, timeUnit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } }
private boolean flushExecutor() { try { boolean ok = pendingRuns.await(10000); return ok; } catch (InterruptedException e) { ActiveMQServerLogger.LOGGER.failedToFlushExecutor(e); return false; } }
@Override public void onCompactDone() { latchDone.countDown(); try { latchWait.await(); } catch (InterruptedException e) { e.printStackTrace(); } } };
/** * @throws InterruptedException */ protected void awaitBlocking() throws InterruptedException { assertTrue(this.inCall.await(5000)); }
@After @Override public void tearDown() throws Exception { Artemis.internalExecute("stop"); Run.latchRunning.await(5, TimeUnit.SECONDS); super.tearDown(); }
@Test public void testLatchWithParameterizedDown() throws Exception { ReusableLatch latch = new ReusableLatch(1000); latch.countDown(5000); assertTrue(latch.await(1000)); assertEquals(0, latch.getCount()); }