public void testSetIfUnset() throws InterruptedException { final BlockingCell<String> cell = new BlockingCell<String>(); assertTrue(cell.setIfUnset("foo")); assertEquals("foo", cell.get()); assertFalse(cell.setIfUnset("bar")); assertEquals("foo", cell.get()); }
@Override public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) { System.out.println( "Shutdown signal terminating consumer " + consumerTag + " with signal " + sig); if (sig.getCause() != null) { sig.printStackTrace(); } _blocker.setIfUnset(sig); }
public void finish() throws IOException { if (!_autoAck) getChannel().basicAck(0, true); _blocker.setIfUnset(new Object()); }