org.elasticsearch.transport.TransportService.shouldTraceAction()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.elasticsearch.transport.TransportService.shouldTraceAction()方法的一些代码示例,展示了TransportService.shouldTraceAction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TransportService.shouldTraceAction()方法的具体详情如下:
包路径:org.elasticsearch.transport.TransportService
类名称:TransportService
方法名:shouldTraceAction

TransportService.shouldTraceAction介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/** called by the {@link Transport} implementation once a request has been sent */
public void onRequestSent(DiscoveryNode node, long requestId, String action, TransportRequest request,
             TransportRequestOptions options) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceRequestSent(node, requestId, action, options);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * called by the {@link Transport} implementation when an incoming request arrives but before
 * any parsing of it has happened (with the exception of the requestId and action)
 */
@Override
public void onRequestReceived(long requestId, String action) {
  try {
    blockIncomingRequestsLatch.await();
  } catch (InterruptedException e) {
    logger.trace("interrupted while waiting for incoming requests block to be removed");
  }
  if (traceEnabled() && shouldTraceAction(action)) {
    traceReceivedRequest(requestId, action);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** called by the {@link Transport} implementation once a response was sent to calling node */
@Override
public void onResponseSent(long requestId, String action, TransportResponse response) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceResponseSent(requestId, action);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** called by the {@link Transport} implementation after an exception was sent as a response to an incoming request */
@Override
public void onResponseSent(long requestId, String action, Exception e) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceResponseSent(requestId, action, e);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public void onResponseReceived(long requestId, Transport.ResponseContext holder) {
  if (holder == null) {
    checkForTimeout(requestId);
  } else if (traceEnabled() && shouldTraceAction(holder.action())) {
    traceReceivedResponse(requestId, holder.connection().getNode(), holder.action());
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void checkForTimeout(long requestId) {
  // lets see if its in the timeout holder, but sync on mutex to make sure any ongoing timeout handling has finished
  final DiscoveryNode sourceNode;
  final String action;
  assert responseHandlers.contains(requestId) == false;
  TimeoutInfoHolder timeoutInfoHolder = timeoutInfoHandlers.remove(requestId);
  if (timeoutInfoHolder != null) {
    long time = threadPool.relativeTimeInMillis();
    logger.warn("Received response for a request that has timed out, sent [{}ms] ago, timed out [{}ms] ago, " +
        "action [{}], node [{}], id [{}]", time - timeoutInfoHolder.sentTime(), time - timeoutInfoHolder.timeoutTime(),
      timeoutInfoHolder.action(), timeoutInfoHolder.node(), requestId);
    action = timeoutInfoHolder.action();
    sourceNode = timeoutInfoHolder.node();
  } else {
    logger.warn("Transport response handler not found of id [{}]", requestId);
    action = null;
    sourceNode = null;
  }
  // call tracer out of lock
  if (traceEnabled() == false) {
    return;
  }
  if (action == null) {
    assert sourceNode == null;
    traceUnresolvedResponse(requestId);
  } else if (shouldTraceAction(action)) {
    traceReceivedResponse(requestId, sourceNode, action);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * called by the {@link Transport} implementation when an incoming request arrives but before
 * any parsing of it has happened (with the exception of the requestId and action)
 */
public void onRequestReceived(long requestId, String action) {
  try {
    blockIncomingRequestsLatch.await();
  } catch (InterruptedException e) {
    logger.trace("interrupted while waiting for incoming requests block to be removed");
  }
  if (traceEnabled() && shouldTraceAction(action)) {
    traceReceivedRequest(requestId, action);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** called by the {@link Transport} implementation once a request has been sent */
public void onRequestSent(DiscoveryNode node, long requestId, String action, TransportRequest request,
             TransportRequestOptions options) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceRequestSent(node, requestId, action, options);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** called by the {@link Transport} implementation after an exception was sent as a response to an incoming request */
public void onResponseSent(long requestId, String action, Exception e) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceResponseSent(requestId, action, e);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public void onResponseReceived(long requestId, Transport.ResponseContext holder) {
  if (holder == null) {
    checkForTimeout(requestId);
  } else if (traceEnabled() && shouldTraceAction(holder.action())) {
    traceReceivedResponse(requestId, holder.connection().getNode(), holder.action());
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** called by the {@link Transport} implementation once a response was sent to calling node */
public void onResponseSent(long requestId, String action, TransportResponse response, TransportResponseOptions options) {
  if (traceEnabled() && shouldTraceAction(action)) {
    traceResponseSent(requestId, action);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public void onResponseReceived(long requestId, Transport.ResponseContext holder) {
  if (holder == null) {
    checkForTimeout(requestId);
  } else if (traceEnabled() && shouldTraceAction(holder.action())) {
    traceReceivedResponse(requestId, holder.connection().getNode(), holder.action());
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void checkForTimeout(long requestId) {
  // lets see if its in the timeout holder, but sync on mutex to make sure any ongoing timeout handling has finished
  final DiscoveryNode sourceNode;
  final String action;
  assert responseHandlers.contains(requestId) == false;
  TimeoutInfoHolder timeoutInfoHolder = timeoutInfoHandlers.remove(requestId);
  if (timeoutInfoHolder != null) {
    long time = threadPool.relativeTimeInMillis();
    logger.warn("Received response for a request that has timed out, sent [{}ms] ago, timed out [{}ms] ago, " +
        "action [{}], node [{}], id [{}]", time - timeoutInfoHolder.sentTime(), time - timeoutInfoHolder.timeoutTime(),
      timeoutInfoHolder.action(), timeoutInfoHolder.node(), requestId);
    action = timeoutInfoHolder.action();
    sourceNode = timeoutInfoHolder.node();
  } else {
    logger.warn("Transport response handler not found of id [{}]", requestId);
    action = null;
    sourceNode = null;
  }
  // call tracer out of lock
  if (traceEnabled() == false) {
    return;
  }
  if (action == null) {
    assert sourceNode == null;
    traceUnresolvedResponse(requestId);
  } else if (shouldTraceAction(action)) {
    traceReceivedResponse(requestId, sourceNode, action);
  }
}

代码示例来源:origin: apache/servicemix-bundles

private void checkForTimeout(long requestId) {
  // lets see if its in the timeout holder, but sync on mutex to make sure any ongoing timeout handling has finished
  final DiscoveryNode sourceNode;
  final String action;
  assert responseHandlers.contains(requestId) == false;
  TimeoutInfoHolder timeoutInfoHolder = timeoutInfoHandlers.remove(requestId);
  if (timeoutInfoHolder != null) {
    long time = System.currentTimeMillis();
    logger.warn("Received response for a request that has timed out, sent [{}ms] ago, timed out [{}ms] ago, " +
        "action [{}], node [{}], id [{}]", time - timeoutInfoHolder.sentTime(), time - timeoutInfoHolder.timeoutTime(),
      timeoutInfoHolder.action(), timeoutInfoHolder.node(), requestId);
    action = timeoutInfoHolder.action();
    sourceNode = timeoutInfoHolder.node();
  } else {
    logger.warn("Transport response handler not found of id [{}]", requestId);
    action = null;
    sourceNode = null;
  }
  // call tracer out of lock
  if (traceEnabled() == false) {
    return;
  }
  if (action == null) {
    assert sourceNode == null;
    traceUnresolvedResponse(requestId);
  } else if (shouldTraceAction(action)) {
    traceReceivedResponse(requestId, sourceNode, action);
  }
}

相关文章

微信公众号

最新文章

更多

TransportService类方法