Fixes #5165 - Wrong messagesIn count for HttpClient.
Now incrementing inMessages only when the response is complete. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
ff3ebeff54
commit
0646e4d0b5
|
@ -40,7 +40,6 @@ public class HttpChannelOverHTTP extends HttpChannel
|
||||||
private final HttpConnectionOverHTTP connection;
|
private final HttpConnectionOverHTTP connection;
|
||||||
private final HttpSenderOverHTTP sender;
|
private final HttpSenderOverHTTP sender;
|
||||||
private final HttpReceiverOverHTTP receiver;
|
private final HttpReceiverOverHTTP receiver;
|
||||||
private final LongAdder inMessages = new LongAdder();
|
|
||||||
private final LongAdder outMessages = new LongAdder();
|
private final LongAdder outMessages = new LongAdder();
|
||||||
|
|
||||||
public HttpChannelOverHTTP(HttpConnectionOverHTTP connection)
|
public HttpChannelOverHTTP(HttpConnectionOverHTTP connection)
|
||||||
|
@ -129,7 +128,6 @@ public class HttpChannelOverHTTP extends HttpChannel
|
||||||
|
|
||||||
public void receive()
|
public void receive()
|
||||||
{
|
{
|
||||||
inMessages.increment();
|
|
||||||
receiver.receive();
|
receiver.receive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +183,7 @@ public class HttpChannelOverHTTP extends HttpChannel
|
||||||
|
|
||||||
protected long getMessagesIn()
|
protected long getMessagesIn()
|
||||||
{
|
{
|
||||||
return inMessages.longValue();
|
return receiver.getMessagesIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMessagesOut()
|
protected long getMessagesOut()
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.client.http;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.concurrent.atomic.LongAdder;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
import org.eclipse.jetty.client.HttpExchange;
|
import org.eclipse.jetty.client.HttpExchange;
|
||||||
|
@ -40,6 +41,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
|
|
||||||
public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.ResponseHandler
|
public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.ResponseHandler
|
||||||
{
|
{
|
||||||
|
private final LongAdder inMessages = new LongAdder();
|
||||||
private final HttpParser parser;
|
private final HttpParser parser;
|
||||||
private RetainableByteBuffer networkBuffer;
|
private RetainableByteBuffer networkBuffer;
|
||||||
private boolean shutdown;
|
private boolean shutdown;
|
||||||
|
@ -333,9 +335,11 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int status = exchange.getResponse().getStatus();
|
int status = exchange.getResponse().getStatus();
|
||||||
|
|
||||||
if (status != HttpStatus.CONTINUE_100)
|
if (status != HttpStatus.CONTINUE_100)
|
||||||
|
{
|
||||||
|
inMessages.increment();
|
||||||
complete = true;
|
complete = true;
|
||||||
|
}
|
||||||
|
|
||||||
return !responseSuccess(exchange);
|
return !responseSuccess(exchange);
|
||||||
}
|
}
|
||||||
|
@ -376,6 +380,11 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
||||||
getHttpConnection().close(failure);
|
getHttpConnection().close(failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getMessagesIn()
|
||||||
|
{
|
||||||
|
return inMessages.longValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue