@Override public void handleException(TransportException e) { contextToRestore.restore(); innerHandler.handleException(e); }
@Override protected void doRun() throws Exception { contextToNotify.handler().handleException(sendRequestException); } });
protected void processException(final TransportResponseHandler handler, final RemoteTransportException rtx) { try { handler.handleException(rtx); } catch (Exception e) { logger.error( () -> new ParameterizedMessage( "failed to handle exception for action [{}], handler [{}]", action, handler), e); } }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
public final <T extends TransportResponse> void sendRequest(final Transport.Connection connection, final String action, final TransportRequest request, final TransportRequestOptions options, TransportResponseHandler<T> handler) { try { asyncSender.sendRequest(connection, action, request, options, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
@Override public void handleException(TransportException exp) { if(handler != null) { handler.cancel(); } try (ThreadContext.StoredContext ignore = contextSupplier.get()) { delegate.handleException(exp); } }
public <T extends TransportResponse> void sendRequest(final DiscoveryNode node, final String action, final TransportRequest request, final TransportResponseHandler<T> handler) { try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, TransportRequestOptions.EMPTY, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
public final <T extends TransportResponse> void sendChildRequest(final DiscoveryNode node, final String action, final TransportRequest request, final Task parentTask, final TransportRequestOptions options, final TransportResponseHandler<T> handler) { try { Transport.Connection connection = getConnection(node); sendChildRequest(connection, action, request, parentTask, options, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
public final <T extends TransportResponse> void sendRequest(final DiscoveryNode node, final String action, final TransportRequest request, final TransportRequestOptions options, TransportResponseHandler<T> handler) { try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, options, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
private void handleException(final TransportResponseHandler handler, Throwable error) { if (!(error instanceof RemoteTransportException)) { error = new RemoteTransportException(error.getMessage(), error); } final RemoteTransportException rtx = (RemoteTransportException) error; threadPool.executor(handler.executor()).execute(() -> { try { handler.handleException(rtx); } catch (Exception e) { logger.error(() -> new ParameterizedMessage("failed to handle exception response [{}]", handler), e); } }); }
@Override public void doRun() { TransportException ex = new TransportException("transport stopped, action: " + holderToNotify.action()); holderToNotify.handler().handleException(ex); } });
public <T extends TransportResponse> void sendChildRequest(final Transport.Connection connection, final String action, final TransportRequest request, final Task parentTask, final TransportRequestOptions options, final TransportResponseHandler<T> handler) { request.setParentTask(localNode.getId(), parentTask.getId()); try { sendRequest(connection, action, request, options, handler); } catch (TaskCancelledException ex) { // The parent task is already cancelled - just fail the request handler.handleException(new TransportException(ex)); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
@Override public void onConnectionClosed(Transport.Connection connection) { try { List<Transport.ResponseContext<? extends TransportResponse>> pruned = responseHandlers.prune(h -> h.connection().getCacheKey().equals(connection.getCacheKey())); // callback that an exception happened, but on a different thread since we don't // want handlers to worry about stack overflows getExecutorService().execute(() -> { for (Transport.ResponseContext holderToNotify : pruned) { holderToNotify.handler().handleException(new NodeDisconnectedException(connection.getNode(), holderToNotify.action())); } }); } catch (EsRejectedExecutionException ex) { logger.debug("Rejected execution on onConnectionClosed", ex); } }
@Override public void run() { if (responseHandlers.contains(requestId)) { long timeoutTime = threadPool.relativeTimeInMillis(); timeoutInfoHandlers.put(requestId, new TimeoutInfoHolder(node, action, sentTime, timeoutTime)); // now that we have the information visible via timeoutInfoHandlers, we try to remove the request id final Transport.ResponseContext holder = responseHandlers.remove(requestId); if (holder != null) { assert holder.action().equals(action); assert holder.connection().getNode().equals(node); holder.handler().handleException( new ReceiveTimeoutTransportException(holder.connection().getNode(), holder.action(), "request_id [" + requestId + "] timed out after [" + (timeoutTime - sentTime) + "ms]")); } else { // response was processed, remove timeout info. timeoutInfoHandlers.remove(requestId); } } }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
@Override public void handleException(TransportException exp) { try { handler.handleException(exp); } finally { setException(exp); } }
@Override public void run() { try { handler.handleException(rtx); } catch (Exception e) { logger.error("Failed to handle exception response", e); } } });
public final <T extends TransportResponse> void sendRequest(final DiscoveryNode node, final String action, final TransportRequest request, final TransportRequestOptions options, TransportResponseHandler<T> handler) { try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, options, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
public <T extends TransportResponse> void sendRequest(final DiscoveryNode node, final String action, final TransportRequest request, final TransportResponseHandler<T> handler) { try { Transport.Connection connection = getConnection(node); sendRequest(connection, action, request, TransportRequestOptions.EMPTY, handler); } catch (NodeNotConnectedException ex) { // the caller might not handle this so we invoke the handler handler.handleException(ex); } }
@Override public void doRun() { TransportException ex = new TransportException("transport stopped, action: " + holderToNotify.action()); holderToNotify.handler().handleException(ex); } });