| | |
| | | private final HTTPStatistics statTracker; |
| | | private boolean useNanoTime = false; |
| | | |
| | | /** Total execution time for this request. */ |
| | | private AtomicLong totalProcessingTime = new AtomicLong(); |
| | | |
| | | /** The protocol in use for this client connection. */ |
| | | private String protocol; |
| | | |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getTotalProcessingTime() |
| | | { |
| | | return totalProcessingTime.get(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getProtocol() |
| | | { |
| | | return protocol; |
| | |
| | | @Override |
| | | public void sendResponse(Operation operation) |
| | | { |
| | | final long time = getProcessingTime(operation); |
| | | this.totalProcessingTime.addAndGet(time); |
| | | |
| | | if (keepStats) |
| | | { |
| | | long time; |
| | | if (useNanoTime) |
| | | { |
| | | time = operation.getProcessingNanoTime(); |
| | | } |
| | | else |
| | | { |
| | | time = operation.getProcessingTime(); |
| | | } |
| | | this.statTracker.updateRequestMonitoringData(getMethod(), time); |
| | | this.statTracker.updateOperationMonitoringData(operation |
| | | .getOperationType(), time); |
| | |
| | | } |
| | | } |
| | | |
| | | private long getProcessingTime(Operation operation) |
| | | { |
| | | if (useNanoTime) |
| | | { |
| | | return operation.getProcessingNanoTime(); |
| | | } |
| | | return operation.getProcessingTime(); |
| | | } |
| | | |
| | | private ProtocolOp toResponseProtocolOp(Operation operation) |
| | | { |
| | | final int resultCode = operation.getResultCode().getIntValue(); |