You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2010/05/15 21:15:43 UTC
svn commit: r944701 -
/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java
Author: veithen
Date: Sat May 15 19:15:43 2010
New Revision: 944701
URL: http://svn.apache.org/viewvc?rev=944701&view=rev
Log:
Take into account that the encoder may switch to completed even if bytesWritten == 0.
Modified:
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java
Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java?rev=944701&r1=944700&r2=944701&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/ClientHandler.java Sat May 15 19:15:43 2010
@@ -555,11 +555,21 @@ public class ClientHandler implements NH
try {
int bytesWritten = outBuf.produceContent(encoder);
- if (metrics != null && bytesWritten > 0) {
- if (metrics.getLevel() == MetricsCollector.LEVEL_FULL) {
- metrics.incrementBytesSent(getMessageContext(conn), bytesWritten);
- } else {
- metrics.incrementBytesSent(bytesWritten);
+ if (metrics != null) {
+ if (bytesWritten > 0) {
+ if (metrics.getLevel() == MetricsCollector.LEVEL_FULL) {
+ metrics.incrementBytesSent(getMessageContext(conn), bytesWritten);
+ } else {
+ metrics.incrementBytesSent(bytesWritten);
+ }
+
+ // TODO: executing this when metrics != 0 && bytesWritten > 0 seems strange;
+ // shouldn't the condition be encoder.isCompleted() ?!?!?
+ ClientConnectionDebug ccd = (ClientConnectionDebug)
+ context.getAttribute(CLIENT_CONNECTION_DEBUG);
+ if (ccd != null) {
+ ccd.recordRequestCompletionTime();
+ }
}
if (encoder.isCompleted()) {
@@ -569,12 +579,6 @@ public class ClientHandler implements NH
metrics.incrementMessagesSent();
}
}
-
- ClientConnectionDebug ccd = (ClientConnectionDebug)
- context.getAttribute(CLIENT_CONNECTION_DEBUG);
- if (ccd != null) {
- ccd.recordRequestCompletionTime();
- }
}
} catch (IOException e) {