private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwables.propagateIfPossible(e.getCause()); throw new PrimitiveException(e.getCause()); } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwables.propagateIfPossible(e.getCause()); throw new PrimitiveException(e.getCause()); } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { if (e.getCause() instanceof PrimitiveException) { throw (PrimitiveException) e.getCause(); } else { throw new PrimitiveException(e.getCause()); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { if (e.getCause() instanceof PrimitiveException) { throw (PrimitiveException) e.getCause(); } else { throw new PrimitiveException(e.getCause()); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); if (cause instanceof PrimitiveException) { throw (PrimitiveException) cause; } else { throw new PrimitiveException(cause); } } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { if (e.getCause() instanceof PrimitiveException) { throw (PrimitiveException) e.getCause(); } else { throw new PrimitiveException(e.getCause()); } } } }
@Override public PrimitiveInfo getPrimitive(String name) { try { return primitives.get(name) .thenApply(value -> value == null ? null : value.map(type -> new PrimitiveInfo(name, primitiveTypeRegistry.getPrimitiveType(type))).value()) .get(DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { throw new PrimitiveException(e.getCause()); } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { throw new PrimitiveException(e.getCause()); } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { throw new PrimitiveException(e.getCause()); } } }
private <T> T complete(CompletableFuture<T> future) { try { return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PrimitiveException.Interrupted(); } catch (TimeoutException e) { throw new PrimitiveException.Timeout(); } catch (ExecutionException e) { throw new PrimitiveException(e.getCause()); } } }