private void initializeWithRetry(ClientProxy clientProxy) throws Exception { long startMillis = System.currentTimeMillis(); while (System.currentTimeMillis() < startMillis + invocationTimeoutMillis) { try { initialize(clientProxy); return; } catch (Exception e) { boolean retryable = isRetryable(e); if (!retryable && e instanceof ExecutionException) { retryable = isRetryable(e.getCause()); } if (retryable) { try { Thread.sleep(invocationRetryPauseMillis); } catch (InterruptedException ignored) { currentThread().interrupt(); } } else { throw e; } } } long elapsedTime = System.currentTimeMillis() - startMillis; throw new OperationTimeoutException("Initializing " + clientProxy.getServiceName() + ":" + clientProxy.getName() + " is timed out after " + elapsedTime + " ms. Configured invocation timeout is " + invocationTimeoutMillis + " ms"); }
protected <T> T invoke(ClientMessage clientMessage) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName()).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
protected <T> T invoke(ClientMessage clientMessage) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName()).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage, int partitionId) throws InterruptedException { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); return (T) future.get(); } catch (Exception e) { throw ExceptionUtil.rethrowAllowInterrupted(e); } }
protected <T> T invokeOnPartition(ClientMessage clientMessage, int partitionId) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
protected <T> T invokeOnAddress(ClientMessage clientMessage, Address address) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), address).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
protected <T> T invokeOnPartition(ClientMessage clientMessage, int partitionId) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
private void initializeWithRetry(ClientProxy clientProxy) throws Exception { long startMillis = System.currentTimeMillis(); while (System.currentTimeMillis() < startMillis + invocationTimeoutMillis) { try { initialize(clientProxy); return; } catch (Exception e) { boolean retryable = isRetryable(e); if (!retryable && e instanceof ExecutionException) { retryable = isRetryable(e.getCause()); } if (retryable) { try { Thread.sleep(invocationRetryPauseMillis); } catch (InterruptedException ignored) { currentThread().interrupt(); } } else { throw e; } } } long elapsedTime = System.currentTimeMillis() - startMillis; throw new OperationTimeoutException("Initializing " + clientProxy.getServiceName() + ":" + clientProxy.getName() + " is timed out after " + elapsedTime + " ms. Configured invocation timeout is " + invocationTimeoutMillis + " ms"); }
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage, int partitionId) throws InterruptedException { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); return (T) future.get(); } catch (Exception e) { throw ExceptionUtil.rethrowAllowInterrupted(e); } }
protected <T> T invokeOnAddress(ClientMessage clientMessage, Address address) { try { final Future future = new ClientInvocation(getClient(), clientMessage, getName(), address).invoke(); return (T) future.get(); } catch (Exception e) { throw rethrow(e); } }
/** * Destroys the remote distributed object counterpart of this proxy by * issuing the destruction request to the cluster. */ public final void destroyRemotely() { ClientMessage clientMessage = ClientDestroyProxyCodec.encodeRequest(getDistributedObjectName(), getServiceName()); try { new ClientInvocation(getClient(), clientMessage, getName()).invoke().get(); } catch (Exception e) { throw rethrow(e); } }
/** * Destroys the remote distributed object counterpart of this proxy by * issuing the destruction request to the cluster. */ public final void destroyRemotely() { ClientMessage clientMessage = ClientDestroyProxyCodec.encodeRequest(getDistributedObjectName(), getServiceName()); try { new ClientInvocation(getClient(), clientMessage, getName()).invoke().get(); } catch (Exception e) { throw rethrow(e); } }