List of usage examples for com.rabbitmq.utility BlockingCell uninterruptibleGet
public synchronized T uninterruptibleGet(int timeout) throws TimeoutException
From source file:uk.trainwatch.rabbitmq.RabbitRPCClient.java
License:Apache License
private byte[] primitiveCall(AMQP.BasicProperties props, byte[] message) throws IOException, ShutdownSignalException, TimeoutException { checkConsumer();/*from w w w .j a v a2 s. c o m*/ BlockingCell<Object> k = new BlockingCell<>(); String replyId = RabbitMQ.newCorrelationId(); props = ((props == null) ? new AMQP.BasicProperties.Builder() : props.builder()).correlationId(replyId) .replyTo(replyQueue).build(); continuationMap.put(replyId, k); publish(props, message); Object reply = k.uninterruptibleGet(timeout); if (reply instanceof ShutdownSignalException) { ShutdownSignalException sig = (ShutdownSignalException) reply; ShutdownSignalException wrapper = new ShutdownSignalException(sig.isHardError(), sig.isInitiatedByApplication(), sig.getReason(), sig.getReference()); wrapper.initCause(sig); throw wrapper; } else { return (byte[]) reply; } }