private PooledSession take() throws SpannerException { SessionOrError s = Uninterruptibles.takeUninterruptibly(waiter); if (s.e != null) { throw newSpannerException(s.e); } return s.session; } }
/** Perform a {@code take} and assert that operation completed in the expected timeframe. */ void takeSuccessfully() { assertEquals(EXPECTED_TAKE, takeUninterruptibly(queue)); completed.assertCompletionExpected(); assertTrue(queue.isEmpty()); }
public void testTakeWithNoWait() { Stopwatch stopwatch = Stopwatch.createStarted(); BlockingQueue<String> queue = new ArrayBlockingQueue<>(1); assertTrue(queue.offer("")); assertEquals("", takeUninterruptibly(queue)); assertTimeNotPassed(stopwatch, LONG_DELAY_MS); }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); Thread.UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); Thread.UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); Thread.UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); Thread.UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); Thread.UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
@SuppressWarnings("InfiniteLoopStatement") @Override public void run() { while (true) { Runnable task = Uninterruptibles.takeUninterruptibly(tasks); try { task.run(); } catch (Throwable throwable) { log.warn("Exception in user thread", throwable); UncaughtExceptionHandler handler = uncaughtExceptionHandler; if (handler != null) handler.uncaughtException(this, throwable); } } }
private PooledSession take() throws SpannerException { SessionOrError s = Uninterruptibles.takeUninterruptibly(waiter); if (s.e != null) { throw newSpannerException(s.e); } return s.session; } }
@Override public void run() { while (true) { try { serializer.serialize(Uninterruptibles.takeUninterruptibly(toSend)); } catch (IOException e) { logger.error(String.format("Communication error with %s:%s", socketAddress.getHostName(), socketAddress.getPort()), e); } } } }).start();
/** * Perform a {@code take} and assert that operation completed in the * expected timeframe. */ void takeSuccessfully() { assertEquals(EXPECTED_TAKE, takeUninterruptibly(queue)); completed.assertCompletionExpected(); assertTrue(queue.isEmpty()); }
public void testTakeWithNoWait() { Stopwatch stopwatch = Stopwatch.createStarted(); BlockingQueue<String> queue = new ArrayBlockingQueue<>(1); assertTrue(queue.offer("")); assertEquals("", takeUninterruptibly(queue)); assertTimeNotPassed(stopwatch, LONG_DELAY_MS); }
takeUninterruptibly(mayInterruptIfRunningChannel)); this.outputFuture = null; return;