Merged branch 'jetty-9.4.x' into 'master'.

This commit is contained in:
Simone Bordet 2016-09-14 21:54:20 +02:00
commit 585e243ed9
3 changed files with 20 additions and 7 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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;
}