Skip to content

Commit

Permalink
Fixed merge from branch 'jetty-9.3.x'.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbordet committed Sep 14, 2016
1 parent d2ddf5f commit e3fcb01
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Expand Up @@ -35,7 +35,6 @@
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;

Expand Down Expand Up @@ -64,6 +63,18 @@ public HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoin
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;
Expand Down Expand Up @@ -101,14 +112,14 @@ public void onFillable()
{
throw new UnsupportedOperationException();
}

private void onFillableBlocking()
{
if (LOG.isDebugEnabled())
LOG.debug("HTTP2 onFillableBlocking {} ", this);
blockingStrategy.produce();
}

private void onFillableNonBlocking()
{
if (LOG.isDebugEnabled())
Expand Down Expand Up @@ -147,11 +158,11 @@ public boolean onIdleExpired()
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();
Expand All @@ -174,7 +185,7 @@ protected class HTTP2Producer implements ExecutionStrategy.Producer

@Override
public synchronized Runnable produce()
{
{
Runnable task = tasks.poll();
if (LOG.isDebugEnabled())
LOG.debug("Dequeued task {}", task);
Expand Down
Expand Up @@ -1114,7 +1114,7 @@ public String toString()

private class ControlEntry extends HTTP2Flusher.Entry
{
private long bytes;
private int bytes;

private ControlEntry(Frame frame, IStream stream, Callback callback)
{
Expand Down
Expand Up @@ -108,6 +108,7 @@ public void onData(DataFrame frame)
while (true)
{
generated += generator.generateData(lease, 13, slice, true, slice.remaining());
generated -= Frame.HEADER_LENGTH;
if (generated == data.remaining())
break;
}
Expand Down Expand Up @@ -147,6 +148,7 @@ public void onData(DataFrame frame)
while (true)
{
generated += generator.generateData(lease, 13, slice, true, slice.remaining());
generated -= Frame.HEADER_LENGTH;
if (generated == data.remaining())
break;
}
Expand Down

0 comments on commit e3fcb01

Please sign in to comment.