Skip to content

Commit

Permalink
Issue #9300 - Rename RetainableByteBufferPool to ByteBufferPool
Browse files Browse the repository at this point in the history
ArrayRetainableByteBufferPool -> ArrayByteBufferPool.
Updated field names.
Updates tests.
Updated *.mod files to not reference RetainableByteBufferPool.
Updated javadocs.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Feb 6, 2023
1 parent 44980eb commit 5cc0799
Show file tree
Hide file tree
Showing 70 changed files with 187 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The `ClientConnector` primarily wraps the link:{javadoc-url}/org/eclipse/jetty/i

* a thread pool (in form of an `java.util.concurrent.Executor`)
* a scheduler (in form of `org.eclipse.jetty.util.thread.Scheduler`)
* a byte buffer pool (in form of `org.eclipse.jetty.io.RetainableByteBufferPool`)
* a byte buffer pool (in form of `org.eclipse.jetty.io.ByteBufferPool`)
* a TLS factory (in form of `org.eclipse.jetty.util.ssl.SslContextFactory.Client`)

The `ClientConnector` is where you want to set those components after you have configured them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpParser;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.ClientConnectionFactory;
import org.eclipse.jetty.io.ClientConnector;
Expand Down Expand Up @@ -201,7 +201,7 @@ protected void doStart() throws Exception
: ProcessorUtils.availableProcessors() * 2;
ByteBufferPool byteBufferPool = getByteBufferPool();
if (byteBufferPool == null)
setByteBufferPool(new ArrayRetainableByteBufferPool(0, 2048, 65536, maxBucketSize));
setByteBufferPool(new ArrayByteBufferPool(0, 2048, 65536, maxBucketSize));
Scheduler scheduler = getScheduler();
if (scheduler == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Content;
import org.eclipse.jetty.server.Handler;
Expand Down Expand Up @@ -243,8 +243,8 @@ protected void service(Request request, org.eclipse.jetty.server.Response respon
});

ByteBufferPool pool = client.getByteBufferPool();
assumeTrue(pool instanceof ArrayRetainableByteBufferPool);
ArrayRetainableByteBufferPool bufferPool = (ArrayRetainableByteBufferPool)pool;
assumeTrue(pool instanceof ArrayByteBufferPool);
ArrayByteBufferPool bufferPool = (ArrayByteBufferPool)pool;

ContentResponse response = client.newRequest("localhost", connector.getLocalPort())
.scheme(scenario.getScheme())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.eclipse.jetty.http.HttpHeaderValue;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.ClientConnectionFactory;
import org.eclipse.jetty.io.ClientConnector;
Expand Down Expand Up @@ -753,7 +753,7 @@ protected int networkFill(ByteBuffer input) throws IOException

assertThrows(Exception.class, () -> client.newRequest("localhost", connector.getLocalPort()).scheme(HttpScheme.HTTPS.asString()).send());

ArrayRetainableByteBufferPool bufferPool = (ArrayRetainableByteBufferPool)server.getByteBufferPool();
ArrayByteBufferPool bufferPool = (ArrayByteBufferPool)server.getByteBufferPool();
Pool<RetainableByteBuffer> bucket = bufferPool.poolFor(16 * 1024 + 1, connector.getConnectionFactory(HttpConnectionFactory.class).isUseInputDirectByteBuffers());
assertEquals(1, bucket.size());
assertEquals(1, bucket.getIdleCount());
Expand All @@ -769,7 +769,7 @@ public void testEncryptedOutputBufferRepooling() throws Exception
QueuedThreadPool serverThreads = new QueuedThreadPool();
serverThreads.setName("server");
List<RetainableByteBuffer> leakedBuffers = new CopyOnWriteArrayList<>();
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool())
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayByteBufferPool())
{
@Override
public RetainableByteBuffer acquire(int size, boolean direct)
Expand Down Expand Up @@ -839,7 +839,7 @@ public void testEncryptedOutputBufferRepoolingAfterNetworkFlushReturnsFalse(bool
QueuedThreadPool serverThreads = new QueuedThreadPool();
serverThreads.setName("server");
List<RetainableByteBuffer> leakedBuffers = new CopyOnWriteArrayList<>();
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool())
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayByteBufferPool())
{
@Override
public RetainableByteBuffer acquire(int size, boolean direct)
Expand Down Expand Up @@ -924,7 +924,7 @@ public void testEncryptedOutputBufferRepoolingAfterNetworkFlushThrows(boolean cl
QueuedThreadPool serverThreads = new QueuedThreadPool();
serverThreads.setName("server");
List<RetainableByteBuffer> leakedBuffers = new CopyOnWriteArrayList<>();
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool())
ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayByteBufferPool())
{
@Override
public RetainableByteBuffer acquire(int size, boolean direct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import javax.net.ssl.SSLHandshakeException;

import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteArrayEndPoint;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EndPoint;
Expand All @@ -43,7 +43,7 @@ public void testSslConnectionClosedBeforeFill() throws Exception
sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.start();

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.start();
ByteArrayEndPoint endPoint = new ByteArrayEndPoint();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.jetty.fcgi.parser.ServerParser;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -59,7 +59,7 @@ public void testGenerateRequestHeaders()
String longLongValue = new String(chars);
fields.put(new HttpField(longLongName, longLongValue));

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ClientGenerator generator = new ClientGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
int id = 13;
Expand Down Expand Up @@ -157,7 +157,7 @@ private void testGenerateRequestContent(int contentLength) throws Exception
{
ByteBuffer content = ByteBuffer.allocate(contentLength);

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ClientGenerator generator = new ClientGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
int id = 13;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.jetty.fcgi.generator.ServerGenerator;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -44,7 +44,7 @@ public void testParseResponseHeaders()
String contentTypeValue = "text/html;charset=utf-8";
fields.put(contentTypeName, contentTypeValue);

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ServerGenerator generator = new ServerGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
generator.generateResponseHeaders(accumulator, id, statusCode, statusMessage, fields);
Expand Down Expand Up @@ -108,7 +108,7 @@ public void testParseNoResponseContent() throws Exception
HttpFields fields = HttpFields.build()
.put("Content-Length", "0");

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ServerGenerator generator = new ServerGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
generator.generateResponseHeaders(accumulator, id, 200, "OK", fields);
Expand Down Expand Up @@ -158,7 +158,7 @@ public void testParseSmallResponseContent() throws Exception
String contentTypeValue = String.valueOf(contentLength);
fields.put(contentTypeName, contentTypeValue);

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ServerGenerator generator = new ServerGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
generator.generateResponseHeaders(accumulator, id, code, "OK", fields);
Expand Down Expand Up @@ -209,7 +209,7 @@ public void testParseLargeResponseContent() throws Exception
String contentTypeValue = String.valueOf(contentLength);
fields.put(contentTypeName, contentTypeValue);

ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
ServerGenerator generator = new ServerGenerator(bufferPool);
ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator();
generator.generateResponseHeaders(accumulator, id, code, "OK", fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.jetty.client.LeakTrackingConnectionPool;
import org.eclipse.jetty.fcgi.client.transport.HttpClientTransportOverFCGI;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.ClientConnector;
import org.eclipse.jetty.server.Handler;
Expand Down Expand Up @@ -53,7 +53,7 @@ public void start(Handler handler) throws Exception
server = new Server(serverThreads);
ServerFCGIConnectionFactory fcgiConnectionFactory = new ServerFCGIConnectionFactory(new HttpConfiguration());
// TODO: restore leak tracking.
serverBufferPool = new ArrayRetainableByteBufferPool();
serverBufferPool = new ArrayByteBufferPool();
connector = new ServerConnector(server, null, null, serverBufferPool,
1, Math.max(1, ProcessorUtils.availableProcessors() / 2), fcgiConnectionFactory);
server.addConnector(connector);
Expand All @@ -67,7 +67,7 @@ public void start(Handler handler) throws Exception
clientConnector.setExecutor(clientThreads);
// TODO: restore leak tracking.
if (clientBufferPool == null)
clientBufferPool = new ArrayRetainableByteBufferPool();
clientBufferPool = new ArrayByteBufferPool();
clientConnector.setByteBufferPool(clientBufferPool);
HttpClientTransport transport = new HttpClientTransportOverFCGI(clientConnector, "");
transport.setConnectionPoolFactory(destination -> new LeakTrackingConnectionPool(destination, client.getMaxConnectionsPerDestination())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.RetainableByteBuffer;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -47,7 +47,7 @@ public class GZIPContentDecoderTest
@BeforeEach
public void before()
{
pool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool())
pool = new ByteBufferPool.Wrapper(new ArrayByteBufferPool())
{
@Override
public RetainableByteBuffer acquire(int size, boolean direct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.eclipse.jetty.http2.hpack.HpackEncoder;
import org.eclipse.jetty.http2.internal.Flags;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -42,7 +42,7 @@ public class ContinuationParseTest
@Test
public void testParseOneByteAtATime() throws Exception
{
ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
ByteBufferPool bufferPool = new ArrayByteBufferPool();
HeadersGenerator generator = new HeadersGenerator(new HeaderGenerator(bufferPool), new HpackEncoder());

final List<HeadersFrame> frames = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.jetty.http2.generator.DataGenerator;
import org.eclipse.jetty.http2.generator.HeaderGenerator;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.util.BufferUtil;
import org.junit.jupiter.api.Test;
Expand All @@ -34,7 +34,7 @@ public class DataGenerateParseTest
{
private final byte[] smallContent = new byte[128];
private final byte[] largeContent = new byte[128 * 1024];
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

public DataGenerateParseTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.jetty.http2.hpack.HpackEncoder;
import org.eclipse.jetty.http2.internal.Flags;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -33,7 +33,7 @@

public class FrameFloodTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

// Frame structure:
// | Len0 | Len1 | Len2 | Type | Flags | StreamID0 |StreamID1 |StreamID2 |StreamID3 | Payload... |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.jetty.http2.generator.GoAwayGenerator;
import org.eclipse.jetty.http2.generator.HeaderGenerator;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -32,7 +32,7 @@

public class GoAwayGenerateParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testGenerateParse() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.eclipse.jetty.http2.generator.HeadersGenerator;
import org.eclipse.jetty.http2.hpack.HpackEncoder;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -38,7 +38,7 @@

public class HeadersGenerateParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testGenerateParse() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.eclipse.jetty.http2.hpack.HpackEncoder;
import org.eclipse.jetty.http2.hpack.HpackException;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

Expand All @@ -37,7 +37,7 @@

public class HeadersTooLargeParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testProtocolErrorURITooLong() throws HpackException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

import org.eclipse.jetty.http2.ErrorCode;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class MaxFrameSizeParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testMaxFrameSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.jetty.http2.generator.HeaderGenerator;
import org.eclipse.jetty.http2.generator.PingGenerator;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.util.NanoTime;
import org.junit.jupiter.api.Test;
Expand All @@ -33,7 +33,7 @@

public class PingGenerateParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testGenerateParse() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import org.eclipse.jetty.http2.generator.HeaderGenerator;
import org.eclipse.jetty.http2.generator.PriorityGenerator;
import org.eclipse.jetty.http2.parser.Parser;
import org.eclipse.jetty.io.ArrayRetainableByteBufferPool;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class PriorityGenerateParseTest
{
private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool();
private final ByteBufferPool bufferPool = new ArrayByteBufferPool();

@Test
public void testGenerateParse() throws Exception
Expand Down
Loading

0 comments on commit 5cc0799

Please sign in to comment.