Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.
This commit is contained in:
commit
a2465234c6
|
@ -51,6 +51,7 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
|||
private final AtomicBoolean closed = new AtomicBoolean();
|
||||
private final AtomicInteger sweeps = new AtomicInteger();
|
||||
private final Session session;
|
||||
private boolean recycleHttpChannels;
|
||||
|
||||
public HttpConnectionOverHTTP2(HttpDestination destination, Session session)
|
||||
{
|
||||
|
@ -63,6 +64,16 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
|||
return session;
|
||||
}
|
||||
|
||||
public boolean isRecycleHttpChannels()
|
||||
{
|
||||
return recycleHttpChannels;
|
||||
}
|
||||
|
||||
public void setRecycleHttpChannels(boolean recycleHttpChannels)
|
||||
{
|
||||
this.recycleHttpChannels = recycleHttpChannels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SendFailure send(HttpExchange exchange)
|
||||
{
|
||||
|
@ -99,7 +110,7 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
|||
// Recycle only non-failed channels.
|
||||
if (channel.isFailed())
|
||||
channel.destroy();
|
||||
else
|
||||
else if (isRecycleHttpChannels())
|
||||
idleChannels.offer(channel);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -213,21 +213,21 @@ public class HttpReceiverOverHTTP2 extends HttpReceiver implements Stream.Listen
|
|||
@Override
|
||||
protected Action process()
|
||||
{
|
||||
DataInfo dataInfo;
|
||||
if (dataInfo != null)
|
||||
{
|
||||
dataInfo.callback.succeeded();
|
||||
if (dataInfo.frame.isEndStream())
|
||||
return Action.SUCCEEDED;
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
dataInfo = queue.poll();
|
||||
}
|
||||
|
||||
if (dataInfo == null)
|
||||
{
|
||||
DataInfo prevDataInfo = this.dataInfo;
|
||||
if (prevDataInfo != null && prevDataInfo.frame.isEndStream())
|
||||
return Action.SUCCEEDED;
|
||||
return Action.IDLE;
|
||||
}
|
||||
|
||||
this.dataInfo = dataInfo;
|
||||
ByteBuffer buffer = dataInfo.frame.getData();
|
||||
if (buffer.hasRemaining())
|
||||
responseContent(dataInfo.exchange, buffer, this);
|
||||
|
@ -244,13 +244,6 @@ public class HttpReceiverOverHTTP2 extends HttpReceiver implements Stream.Listen
|
|||
((Retainable)callback).retain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
dataInfo.callback.succeeded();
|
||||
super.succeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCompleteSuccess()
|
||||
{
|
||||
|
@ -263,6 +256,14 @@ public class HttpReceiverOverHTTP2 extends HttpReceiver implements Stream.Listen
|
|||
dataInfo.callback.failed(failure);
|
||||
responseFailure(failure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reset()
|
||||
{
|
||||
queue.clear();
|
||||
dataInfo = null;
|
||||
return super.reset();
|
||||
}
|
||||
}
|
||||
|
||||
private static class DataInfo
|
||||
|
|
Loading…
Reference in New Issue