diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java index 20a207aba6e..a269e38c50c 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java @@ -35,7 +35,6 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.ExecutionStrategy; import org.eclipse.jetty.util.thread.Invocable; -import org.eclipse.jetty.util.thread.Invocable.InvocationType; import org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume; import org.eclipse.jetty.util.thread.strategy.ProduceExecuteConsume; @@ -64,6 +63,18 @@ public class HTTP2Connection extends AbstractConnection this.nonBlockingStrategy = new ProduceExecuteConsume(producer, executor); } + @Override + public long getBytesIn() + { + return bytesIn.get(); + } + + @Override + public long getBytesOut() + { + return session.getBytesWritten(); + } + public ISession getSession() { return session; @@ -101,14 +112,14 @@ public class HTTP2Connection extends AbstractConnection { throw new UnsupportedOperationException(); } - + private void onFillableBlocking() { if (LOG.isDebugEnabled()) LOG.debug("HTTP2 onFillableBlocking {} ", this); blockingStrategy.produce(); } - + private void onFillableNonBlocking() { if (LOG.isDebugEnabled()) @@ -147,11 +158,11 @@ public class HTTP2Connection extends AbstractConnection protected void offerTask(Runnable task, boolean dispatch) { tasks.offer(task); - + // Because producing calls parse and parse can call offerTask, we have to make sure // we use the same strategy otherwise produce can be reentrant and that messes with // the release mechanism. TODO is this test sufficient to protect from this? - ExecutionStrategy s = Invocable.isNonBlockingInvocation()?nonBlockingStrategy:blockingStrategy; + ExecutionStrategy s = Invocable.isNonBlockingInvocation() ? nonBlockingStrategy : blockingStrategy; if (dispatch) // TODO Why again is this necessary? s.dispatch(); @@ -174,7 +185,7 @@ public class HTTP2Connection extends AbstractConnection @Override public synchronized Runnable produce() - { + { Runnable task = tasks.poll(); if (LOG.isDebugEnabled()) LOG.debug("Dequeued task {}", task); diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java index 8d8fd272b54..920a1759de6 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java @@ -1114,7 +1114,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio private class ControlEntry extends HTTP2Flusher.Entry { - private long bytes; + private int bytes; private ControlEntry(Frame frame, IStream stream, Callback callback) { diff --git a/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java b/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java index d730589a70a..0da6986cb86 100644 --- a/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java +++ b/jetty-http2/http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java @@ -108,6 +108,7 @@ public class DataGenerateParseTest while (true) { generated += generator.generateData(lease, 13, slice, true, slice.remaining()); + generated -= Frame.HEADER_LENGTH; if (generated == data.remaining()) break; } @@ -147,6 +148,7 @@ public class DataGenerateParseTest while (true) { generated += generator.generateData(lease, 13, slice, true, slice.remaining()); + generated -= Frame.HEADER_LENGTH; if (generated == data.remaining()) break; }