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"); }
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"); }
private void initialize(ClientProxy clientProxy) throws Exception { Address initializationTarget = findNextAddressToSendCreateRequest(); if (initializationTarget == null) { throw new IOException("Not able to find a member to create proxy on!"); } ClientMessage clientMessage = ClientCreateProxyCodec.encodeRequest(clientProxy.getDistributedObjectName(), clientProxy.getServiceName(), initializationTarget); new ClientInvocation(client, clientMessage, clientProxy.getServiceName(), initializationTarget).invoke().get(); clientProxy.onInitialize(); }
private void initialize(ClientProxy clientProxy) throws Exception { Address initializationTarget = findNextAddressToSendCreateRequest(); if (initializationTarget == null) { throw new IOException("Not able to find a member to create proxy on!"); } ClientMessage clientMessage = ClientCreateProxyCodec.encodeRequest(clientProxy.getDistributedObjectName(), clientProxy.getServiceName(), initializationTarget); new ClientInvocation(client, clientMessage, clientProxy.getServiceName(), initializationTarget).invoke().get(); clientProxy.onInitialize(); }
ObjectNamespace objectNamespace = new DistributedObjectNamespace(proxy.getServiceName(), proxy.getDistributedObjectName()); ClientProxyFuture registeredProxyFuture = proxies.remove(objectNamespace);
ObjectNamespace objectNamespace = new DistributedObjectNamespace(proxy.getServiceName(), proxy.getDistributedObjectName()); ClientProxyFuture registeredProxyFuture = proxies.remove(objectNamespace);
/** * 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); } }