private static void waitForStatusOK(CallFuture<Status> callFuture,
long timeout, TimeUnit tu) throws EventDeliveryException {
try {
Status status = callFuture.get(timeout, tu);
if (status != Status.OK) {
throw new EventDeliveryException("Status (" + status + ") is not OK");
}
} catch (CancellationException ex) {
throw new EventDeliveryException("RPC future was cancelled." +
" Exception follows.", ex);
} catch (ExecutionException ex) {
throw new EventDeliveryException("Exception thrown from remote handler." +
" Exception follows.", ex);
} catch (TimeoutException ex) {
throw new EventDeliveryException("RPC request timed out." +
" Exception follows.", ex);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new EventDeliveryException("RPC request interrupted." +
" Exception follows.", ex);
}
}