After review, renamed *directBuffers to *directByteBuffers.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
1ef4a416b5
commit
0eec727a09
|
@ -56,8 +56,8 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher.
|
||||||
private final ISession session;
|
private final ISession session;
|
||||||
private final int bufferSize;
|
private final int bufferSize;
|
||||||
private final ExecutionStrategy strategy;
|
private final ExecutionStrategy strategy;
|
||||||
private boolean useInputDirectBuffers;
|
private boolean useInputDirectByteBuffers;
|
||||||
private boolean useOutputDirectBuffers;
|
private boolean useOutputDirectByteBuffers;
|
||||||
|
|
||||||
public HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
|
public HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
|
||||||
{
|
{
|
||||||
|
@ -103,22 +103,22 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher.
|
||||||
|
|
||||||
public boolean isUseInputDirectByteBuffers()
|
public boolean isUseInputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return useInputDirectBuffers;
|
return useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useInputDirectBuffers = useInputDirectBuffers;
|
this.useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return useOutputDirectBuffers;
|
return useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useOutputDirectBuffers = useOutputDirectBuffers;
|
this.useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,11 +42,11 @@ public class Generator
|
||||||
this(byteBufferPool, true, maxDynamicTableSize, maxHeaderBlockFragment);
|
this(byteBufferPool, true, maxDynamicTableSize, maxHeaderBlockFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Generator(ByteBufferPool byteBufferPool, boolean directBuffers, int maxDynamicTableSize, int maxHeaderBlockFragment)
|
public Generator(ByteBufferPool byteBufferPool, boolean useDirectByteBuffers, int maxDynamicTableSize, int maxHeaderBlockFragment)
|
||||||
{
|
{
|
||||||
this.byteBufferPool = byteBufferPool;
|
this.byteBufferPool = byteBufferPool;
|
||||||
|
|
||||||
headerGenerator = new HeaderGenerator(directBuffers);
|
headerGenerator = new HeaderGenerator(useDirectByteBuffers);
|
||||||
hpackEncoder = new HpackEncoder(maxDynamicTableSize);
|
hpackEncoder = new HpackEncoder(maxDynamicTableSize);
|
||||||
|
|
||||||
this.generators = new FrameGenerator[FrameType.values().length];
|
this.generators = new FrameGenerator[FrameType.values().length];
|
||||||
|
|
|
@ -27,21 +27,21 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
public class HeaderGenerator
|
public class HeaderGenerator
|
||||||
{
|
{
|
||||||
private int maxFrameSize = Frame.DEFAULT_MAX_LENGTH;
|
private int maxFrameSize = Frame.DEFAULT_MAX_LENGTH;
|
||||||
private final boolean directBuffers;
|
private final boolean useDirectByteBuffers;
|
||||||
|
|
||||||
public HeaderGenerator()
|
public HeaderGenerator()
|
||||||
{
|
{
|
||||||
this(true);
|
this(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HeaderGenerator(boolean directBuffers)
|
public HeaderGenerator(boolean useDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.directBuffers = directBuffers;
|
this.useDirectByteBuffers = useDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseDirectByteBuffers()
|
public boolean isUseDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return directBuffers;
|
return useDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer generate(ByteBufferPool.Lease lease, FrameType frameType, int capacity, int length, int flags, int streamId)
|
public ByteBuffer generate(ByteBufferPool.Lease lease, FrameType frameType, int capacity, int length, int flags, int streamId)
|
||||||
|
|
|
@ -64,8 +64,8 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
||||||
private RateControl rateControl = new WindowRateControl(20, Duration.ofSeconds(1));
|
private RateControl rateControl = new WindowRateControl(20, Duration.ofSeconds(1));
|
||||||
private FlowControlStrategy.Factory flowControlStrategyFactory = () -> new BufferingFlowControlStrategy(0.5F);
|
private FlowControlStrategy.Factory flowControlStrategyFactory = () -> new BufferingFlowControlStrategy(0.5F);
|
||||||
private long streamIdleTimeout;
|
private long streamIdleTimeout;
|
||||||
private boolean _useInputDirectBuffers;
|
private boolean _useInputDirectByteBuffers;
|
||||||
private boolean _useOutputDirectBuffers;
|
private boolean _useOutputDirectByteBuffers;
|
||||||
|
|
||||||
public AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
|
public AbstractHTTP2ServerConnectionFactory(@Name("config") HttpConfiguration httpConfiguration)
|
||||||
{
|
{
|
||||||
|
@ -198,22 +198,22 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
||||||
|
|
||||||
public boolean isUseInputDirectByteBuffers()
|
public boolean isUseInputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useInputDirectBuffers;
|
return _useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useInputDirectBuffers = useInputDirectBuffers;
|
_useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useOutputDirectBuffers;
|
return _useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useOutputDirectBuffers = useOutputDirectBuffers;
|
_useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpConfiguration getHttpConfiguration()
|
public HttpConfiguration getHttpConfiguration()
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class HttpChannelOverHTTP2 extends HttpChannel implements Closeable, Writ
|
||||||
|
|
||||||
private boolean _expect100Continue;
|
private boolean _expect100Continue;
|
||||||
private boolean _delayedUntilContent;
|
private boolean _delayedUntilContent;
|
||||||
private boolean _useOutputDirectBuffers;
|
private boolean _useOutputDirectByteBuffers;
|
||||||
|
|
||||||
public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport)
|
public HttpChannelOverHTTP2(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransportOverHTTP2 transport)
|
||||||
{
|
{
|
||||||
|
@ -72,12 +72,12 @@ public class HttpChannelOverHTTP2 extends HttpChannel implements Closeable, Writ
|
||||||
@Override
|
@Override
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useOutputDirectBuffers;
|
return _useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useOutputDirectBuffers = useOutputDirectBuffers;
|
_useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -72,8 +72,8 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
private final boolean _recordHttpComplianceViolations;
|
private final boolean _recordHttpComplianceViolations;
|
||||||
private final LongAdder bytesIn = new LongAdder();
|
private final LongAdder bytesIn = new LongAdder();
|
||||||
private final LongAdder bytesOut = new LongAdder();
|
private final LongAdder bytesOut = new LongAdder();
|
||||||
private boolean _useInputDirectBuffers;
|
private boolean _useInputDirectByteBuffers;
|
||||||
private boolean _useOutputDirectBuffers;
|
private boolean _useOutputDirectByteBuffers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current connection that this thread is dispatched to.
|
* Get the current connection that this thread is dispatched to.
|
||||||
|
@ -179,22 +179,22 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
|
|
||||||
public boolean isUseInputDirectByteBuffers()
|
public boolean isUseInputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useInputDirectBuffers;
|
return _useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useInputDirectBuffers = useInputDirectBuffers;
|
_useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useOutputDirectBuffers;
|
return _useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useOutputDirectBuffers = useOutputDirectBuffers;
|
_useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -240,8 +240,8 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
{
|
{
|
||||||
if (_requestBuffer == null)
|
if (_requestBuffer == null)
|
||||||
{
|
{
|
||||||
boolean useDirectBuffers = isUseInputDirectByteBuffers();
|
boolean useDirectByteBuffers = isUseInputDirectByteBuffers();
|
||||||
_requestBuffer = _bufferPool.acquire(getInputBufferSize(), useDirectBuffers);
|
_requestBuffer = _bufferPool.acquire(getInputBufferSize(), useDirectByteBuffers);
|
||||||
}
|
}
|
||||||
return _requestBuffer;
|
return _requestBuffer;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
if (_callback == null)
|
if (_callback == null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
||||||
boolean useDirectBuffers = isUseOutputDirectByteBuffers();
|
boolean useDirectByteBuffers = isUseOutputDirectByteBuffers();
|
||||||
ByteBuffer chunk = _chunk;
|
ByteBuffer chunk = _chunk;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -771,19 +771,19 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
|
|
||||||
case NEED_HEADER:
|
case NEED_HEADER:
|
||||||
{
|
{
|
||||||
_header = _bufferPool.acquire(_config.getResponseHeaderSize(), useDirectBuffers);
|
_header = _bufferPool.acquire(_config.getResponseHeaderSize(), useDirectByteBuffers);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case NEED_CHUNK:
|
case NEED_CHUNK:
|
||||||
{
|
{
|
||||||
chunk = _chunk = _bufferPool.acquire(HttpGenerator.CHUNK_SIZE, useDirectBuffers);
|
chunk = _chunk = _bufferPool.acquire(HttpGenerator.CHUNK_SIZE, useDirectByteBuffers);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case NEED_CHUNK_TRAILER:
|
case NEED_CHUNK_TRAILER:
|
||||||
{
|
{
|
||||||
if (_chunk != null)
|
if (_chunk != null)
|
||||||
_bufferPool.release(_chunk);
|
_bufferPool.release(_chunk);
|
||||||
chunk = _chunk = _bufferPool.acquire(_config.getResponseHeaderSize(), useDirectBuffers);
|
chunk = _chunk = _bufferPool.acquire(_config.getResponseHeaderSize(), useDirectByteBuffers);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case FLUSH:
|
case FLUSH:
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
||||||
{
|
{
|
||||||
private final HttpConfiguration _config;
|
private final HttpConfiguration _config;
|
||||||
private boolean _recordHttpComplianceViolations;
|
private boolean _recordHttpComplianceViolations;
|
||||||
private boolean _useInputDirectBuffers;
|
private boolean _useInputDirectByteBuffers;
|
||||||
private boolean _useOutputDirectBuffers;
|
private boolean _useOutputDirectByteBuffers;
|
||||||
|
|
||||||
public HttpConnectionFactory()
|
public HttpConnectionFactory()
|
||||||
{
|
{
|
||||||
|
@ -70,22 +70,22 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
||||||
|
|
||||||
public boolean isUseInputDirectByteBuffers()
|
public boolean isUseInputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useInputDirectBuffers;
|
return _useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useInputDirectBuffers = useInputDirectBuffers;
|
_useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return _useOutputDirectBuffers;
|
return _useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
_useOutputDirectBuffers = useOutputDirectBuffers;
|
_useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class FrameFlusher extends IteratingCallback
|
||||||
private boolean flushed = true;
|
private boolean flushed = true;
|
||||||
private Throwable closedCause;
|
private Throwable closedCause;
|
||||||
private long idleTimeout;
|
private long idleTimeout;
|
||||||
private boolean useDirectBuffers;
|
private boolean useDirectByteBuffers;
|
||||||
|
|
||||||
public FrameFlusher(ByteBufferPool bufferPool, Scheduler scheduler, Generator generator, EndPoint endPoint, int bufferSize, int maxGather)
|
public FrameFlusher(ByteBufferPool bufferPool, Scheduler scheduler, Generator generator, EndPoint endPoint, int bufferSize, int maxGather)
|
||||||
{
|
{
|
||||||
|
@ -87,12 +87,12 @@ public class FrameFlusher extends IteratingCallback
|
||||||
|
|
||||||
public boolean isUseDirectByteBuffers()
|
public boolean isUseDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return useDirectBuffers;
|
return useDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseDirectByteBuffers(boolean useDirectBuffers)
|
public void setUseDirectByteBuffers(boolean useDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useDirectBuffers = useDirectBuffers;
|
this.useDirectByteBuffers = useDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
|
|
||||||
// Read / Parse variables
|
// Read / Parse variables
|
||||||
private RetainableByteBuffer networkBuffer;
|
private RetainableByteBuffer networkBuffer;
|
||||||
private boolean useInputDirectBuffers;
|
private boolean useInputDirectByteBuffers;
|
||||||
private boolean useOutputDirectBuffers;
|
private boolean useOutputDirectByteBuffers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WSConnection.
|
* Create a WSConnection.
|
||||||
|
@ -136,22 +136,22 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
|
||||||
|
|
||||||
public boolean isUseInputDirectByteBuffers()
|
public boolean isUseInputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return useInputDirectBuffers;
|
return useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseInputDirectByteBuffers(boolean useInputDirectBuffers)
|
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useInputDirectBuffers = useInputDirectBuffers;
|
this.useInputDirectByteBuffers = useInputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUseOutputDirectByteBuffers()
|
public boolean isUseOutputDirectByteBuffers()
|
||||||
{
|
{
|
||||||
return useOutputDirectBuffers;
|
return useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseOutputDirectByteBuffers(boolean useOutputDirectBuffers)
|
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
|
||||||
{
|
{
|
||||||
this.useOutputDirectBuffers = useOutputDirectBuffers;
|
this.useOutputDirectByteBuffers = useOutputDirectByteBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue