final DiscoveryNode node = connection.getNode(); try { PlainTransportFuture<HandshakeResponse> futureHandler = new PlainTransportFuture<>( new FutureTransportResponseHandler<HandshakeResponse>() { @Override sendRequest(connection, HANDSHAKE_ACTION_NAME, HandshakeRequest.INSTANCE, TransportRequestOptions.builder().withTimeout(handshakeTimeout).build(), futureHandler); response = futureHandler.txGet(); } catch (Exception e) { throw new IllegalStateException("handshake failed with " + node, e);
@Override public V txGet() { try { return get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Future got interrupted", e); } catch (ExecutionException e) { if (e.getCause() instanceof ElasticsearchException) { throw (ElasticsearchException) e.getCause(); } else { throw new TransportException("Failed execution", e); } } }
@Override public void handleResponse(V response) { try { handler.handleResponse(response); set(response); } catch (Exception e) { handleException(new ResponseHandlerFailureTransportException(e)); } }
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) throws TransportException { PlainTransportFuture<T> futureHandler = new PlainTransportFuture<>(handler); try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, options, futureHandler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler futureHandler.handleException(ex); } return futureHandler; }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) throws TransportException { PlainTransportFuture<T> futureHandler = new PlainTransportFuture<>(handler); sendRequest(node, action, request, options, futureHandler); return futureHandler; }
sendRequest(connection, HANDSHAKE_ACTION_NAME, HandshakeRequest.INSTANCE, TransportRequestOptions.builder().withTimeout(handshakeTimeout).build(), futureHandler); response = futureHandler.txGet(); } catch (Exception e) { throw new IllegalStateException("handshake failed with " + node, e);
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) throws TransportException { PlainTransportFuture<T> futureHandler = new PlainTransportFuture<>(handler); try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, options, futureHandler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler futureHandler.handleException(ex); } return futureHandler; }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
@Override public void handleResponse(V response) { try { handler.handleResponse(response); set(response); } catch (Exception e) { handleException(new ResponseHandlerFailureTransportException(e)); } }
for (DiscoveryNode listedNode : listedNodes) { try (Transport.Connection connection = transportService.openConnection(listedNode, LISTED_NODES_PROFILE)){ final PlainTransportFuture<LivenessResponse> handler = new PlainTransportFuture<>( new FutureTransportResponseHandler<LivenessResponse>() { @Override TransportRequestOptions.builder().withType(TransportRequestOptions.Type.STATE).withTimeout(pingTimeout).build(), handler); final LivenessResponse livenessResponse = handler.txGet(); if (!ignoreClusterName && !clusterName.equals(livenessResponse.getClusterName())) { logger.warn("node {} not part of the cluster {}, ignoring...", listedNode, clusterName);
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) throws TransportException { PlainTransportFuture<T> futureHandler = new PlainTransportFuture<>(handler); try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, options, futureHandler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler futureHandler.handleException(ex); } return futureHandler; }
@Override public V txGet(long timeout, TimeUnit unit) { try { return get(timeout, unit); } catch (TimeoutException e) { throw new ElasticsearchTimeoutException(e); } catch (InterruptedException e) { throw new IllegalStateException("Future got interrupted", e); } catch (ExecutionException e) { if (e.getCause() instanceof ElasticsearchException) { throw (ElasticsearchException) e.getCause(); } else { throw new TransportException("Failed execution", e); } } }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
@Override public void handleResponse(V response) { try { handler.handleResponse(response); set(response); } catch (Exception e) { handleException(new ResponseHandlerFailureTransportException(e)); } }
final DiscoveryNode node = connection.getNode(); try { PlainTransportFuture<HandshakeResponse> futureHandler = new PlainTransportFuture<>( new FutureTransportResponseHandler<HandshakeResponse>() { @Override sendRequest(connection, HANDSHAKE_ACTION_NAME, HandshakeRequest.INSTANCE, TransportRequestOptions.builder().withTimeout(handshakeTimeout).build(), futureHandler); response = futureHandler.txGet(); } catch (Exception e) { throw new IllegalStateException("handshake failed with " + node, e);
@Override public V txGet() { try { return get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Future got interrupted", e); } catch (ExecutionException e) { if (e.getCause() instanceof ElasticsearchException) { throw (ElasticsearchException) e.getCause(); } else { throw new TransportException("Failed execution", e); } } }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
@Override public void handleResponse(V response) { try { handler.handleResponse(response); set(response); } catch (Exception e) { handleException(new ResponseHandlerFailureTransportException(e)); } }
final DiscoveryNode node = connection.getNode(); try { PlainTransportFuture<HandshakeResponse> futureHandler = new PlainTransportFuture<>( new FutureTransportResponseHandler<HandshakeResponse>() { @Override sendRequest(connection, HANDSHAKE_ACTION_NAME, HandshakeRequest.INSTANCE, TransportRequestOptions.builder().withTimeout(handshakeTimeout).build(), futureHandler); response = futureHandler.txGet(); } catch (Exception e) { throw new IllegalStateException("handshake failed with " + node, e);