From 0a0fd8d72298f8ffad266ec780e84d3f561a6600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Date: Fri, 3 Feb 2023 19:48:52 +0100 Subject: [PATCH] Rename RetainableByteBufferPool to ByteBufferPool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With issue #9166, ByteBufferPool was removed and replaced by RetainableByteBufferPool. Since ByteBufferPool was used by AbstractConnector, this change broke backwards compatibility with third-party connectors such as junixsocket-jetty. Since there's no longer any other ByteBufferPool, rename the RetainableByteBufferPool interface, and thereby not only reinstate compatibility with existing third-party libraries but also save a few keystrokes. https://github.com/eclipse/jetty.project/issues/9284 Signed-off-by: Christian Kohlschütter --- .../client/ClientConnectorDocs.java | 2 +- .../AbstractConnectorHttpClientTransport.java | 2 +- .../jetty/client/GZIPContentDecoder.java | 18 ++++----- .../org/eclipse/jetty/client/HttpClient.java | 24 +++++------ .../client/InputStreamRequestContent.java | 4 +- .../jetty/client/PathRequestContent.java | 6 +-- .../internal/HttpReceiverOverHTTP.java | 8 ++-- .../internal/HttpSenderOverHTTP.java | 6 +-- .../jetty/client/HttpClientGZIPTest.java | 4 +- .../jetty/client/HttpClientTLSTest.java | 40 +++++++++---------- .../jetty/client/ssl/SslConnectionTest.java | 4 +- .../util/MultiPartRequestContentTest.java | 2 +- .../internal/HttpChannelOverFCGI.java | 4 +- .../internal/HttpConnectionOverFCGI.java | 6 +-- .../internal/HttpSenderOverFCGI.java | 8 ++-- .../jetty/fcgi/generator/ClientGenerator.java | 16 ++++---- .../eclipse/jetty/fcgi/generator/Flusher.java | 6 +-- .../jetty/fcgi/generator/Generator.java | 12 +++--- .../jetty/fcgi/generator/ServerGenerator.java | 12 +++--- .../fcgi/generator/ClientGeneratorTest.java | 10 ++--- .../jetty/fcgi/parser/ClientParserTest.java | 18 ++++----- .../server/internal/HttpStreamOverFCGI.java | 14 +++---- .../server/internal/ServerFCGIConnection.java | 8 ++-- .../server/AbstractHttpClientServerTest.java | 8 ++-- .../jetty/http/GZIPContentDecoder.java | 12 +++--- .../content/CachingHttpContentFactory.java | 8 ++-- .../ValidatingCachingHttpContentFactory.java | 10 ++--- .../jetty/http/GZIPContentDecoderTest.java | 6 +-- .../HttpClientTransportOverHTTP2.java | 2 +- .../jetty/http2/client/HTTP2Client.java | 12 +++--- .../client/HTTP2ClientConnectionFactory.java | 8 ++-- .../eclipse/jetty/http2/HTTP2Connection.java | 10 ++--- .../org/eclipse/jetty/http2/HTTP2Session.java | 8 ++-- .../jetty/http2/generator/DataGenerator.java | 8 ++-- .../jetty/http2/generator/FrameGenerator.java | 6 +-- .../jetty/http2/generator/Generator.java | 16 ++++---- .../http2/generator/GoAwayGenerator.java | 6 +-- .../http2/generator/HeaderGenerator.java | 12 +++--- .../http2/generator/HeadersGenerator.java | 6 +-- .../jetty/http2/generator/NoOpGenerator.java | 4 +- .../jetty/http2/generator/PingGenerator.java | 6 +-- .../http2/generator/PrefaceGenerator.java | 4 +- .../http2/generator/PriorityGenerator.java | 6 +-- .../http2/generator/PushPromiseGenerator.java | 6 +-- .../jetty/http2/generator/ResetGenerator.java | 6 +-- .../http2/generator/SettingsGenerator.java | 6 +-- .../generator/WindowUpdateGenerator.java | 6 +-- .../jetty/http2/internal/HTTP2Flusher.java | 6 +-- .../http2/parser/HeaderBlockFragments.java | 6 +-- .../jetty/http2/parser/HeaderBlockParser.java | 6 +-- .../eclipse/jetty/http2/parser/Parser.java | 8 ++-- .../jetty/http2/parser/ServerParser.java | 4 +- .../http2/frames/ContinuationParseTest.java | 6 +-- .../http2/frames/DataGenerateParseTest.java | 8 ++-- .../jetty/http2/frames/FrameFloodTest.java | 4 +- .../http2/frames/GoAwayGenerateParseTest.java | 8 ++-- .../frames/HeadersGenerateParseTest.java | 8 ++-- .../frames/HeadersTooLargeParseTest.java | 6 +-- .../http2/frames/MaxFrameSizeParseTest.java | 4 +- .../http2/frames/PingGenerateParseTest.java | 10 ++--- .../frames/PriorityGenerateParseTest.java | 8 ++-- .../frames/PushPromiseGenerateParseTest.java | 8 ++-- .../http2/frames/ResetGenerateParseTest.java | 8 ++-- .../frames/SettingsGenerateParseTest.java | 14 +++---- .../jetty/http2/frames/UnknownParseTest.java | 4 +- .../frames/WindowUpdateGenerateParseTest.java | 8 ++-- .../AbstractHTTP2ServerConnectionFactory.java | 10 ++--- .../internal/HTTP2ServerConnection.java | 6 +-- .../jetty/http2/tests/AbstractServerTest.java | 4 +- .../eclipse/jetty/http2/tests/BadURITest.java | 6 +-- .../eclipse/jetty/http2/tests/CloseTest.java | 8 ++-- .../jetty/http2/tests/DataDemandTest.java | 6 +-- .../http2/tests/FlowControlStrategyTest.java | 6 +-- .../jetty/http2/tests/HTTP2CServerTest.java | 8 ++-- .../jetty/http2/tests/HTTP2ServerTest.java | 32 +++++++-------- .../HttpClientTransportOverHTTP2Test.java | 8 ++-- .../jetty/http2/tests/PrefaceTest.java | 10 ++--- .../jetty/http2/tests/StreamCountTest.java | 4 +- .../jetty/http2/tests/StreamResetTest.java | 10 ++--- .../HttpClientTransportOverHTTP3.java | 2 +- .../http3/client/ClientHTTP3Session.java | 8 ++-- .../internal/ClientHTTP3StreamConnection.java | 2 +- .../eclipse/jetty/http3/ControlFlusher.java | 8 ++-- .../jetty/http3/DecoderStreamConnection.java | 4 +- .../jetty/http3/EncoderStreamConnection.java | 4 +- .../jetty/http3/HTTP3StreamConnection.java | 6 +-- .../jetty/http3/InstructionFlusher.java | 10 ++--- .../http3/InstructionStreamConnection.java | 6 +-- .../eclipse/jetty/http3/MessageFlusher.java | 8 ++-- .../http3/UnidirectionalStreamConnection.java | 6 +-- .../http3/generator/CancelPushGenerator.java | 6 +-- .../http3/generator/ControlGenerator.java | 6 +-- .../jetty/http3/generator/DataGenerator.java | 10 ++--- .../jetty/http3/generator/FrameGenerator.java | 10 ++--- .../http3/generator/GoAwayGenerator.java | 10 ++--- .../http3/generator/HeadersGenerator.java | 10 ++--- .../http3/generator/MaxPushIdGenerator.java | 6 +-- .../http3/generator/MessageGenerator.java | 6 +-- .../http3/generator/PushPromiseGenerator.java | 6 +-- .../http3/generator/SettingsGenerator.java | 10 ++--- .../internal/ControlStreamConnection.java | 6 +-- .../http3/internal/DataGenerateParseTest.java | 6 +-- .../internal/GoAwayGenerateParseTest.java | 6 +-- .../internal/HeadersGenerateParseTest.java | 6 +-- .../internal/SettingsGenerateParseTest.java | 6 +-- .../jetty/http3/qpack/Instruction.java | 4 +- .../jetty/http3/qpack/QpackDecoder.java | 8 ++-- .../jetty/http3/qpack/QpackEncoder.java | 8 ++-- .../instruction/AbstractInstruction.java | 8 ++-- .../instruction/DuplicateInstruction.java | 8 ++-- .../IndexedNameEntryInstruction.java | 8 ++-- .../InsertCountIncrementInstruction.java | 8 ++-- .../LiteralNameEntryInstruction.java | 10 ++--- .../SectionAcknowledgmentInstruction.java | 8 ++-- .../instruction/SetCapacityInstruction.java | 8 ++-- .../StreamCancellationInstruction.java | 8 ++-- .../jetty/http3/qpack/BlockedStreamsTest.java | 4 +- .../jetty/http3/qpack/EncodeDecodeTest.java | 10 ++--- .../jetty/http3/qpack/EvictionTest.java | 4 +- .../http3/qpack/InstructionGeneratorTest.java | 6 +-- .../jetty/http3/qpack/QpackTestUtil.java | 6 +-- .../qpack/SectionAcknowledgmentTest.java | 6 +-- .../http3/server/HTTP3ServerConnector.java | 4 +- .../server/internal/ServerHTTP3Session.java | 8 ++-- .../internal/ServerHTTP3StreamConnection.java | 2 +- .../io/ArrayRetainableByteBufferPool.java | 4 +- .../jetty/io/ByteBufferAccumulator.java | 8 ++-- .../jetty/io/ByteBufferOutputStream2.java | 6 +-- ...yteBufferPool.java => ByteBufferPool.java} | 16 ++++---- .../org/eclipse/jetty/io/ClientConnector.java | 16 ++++---- .../jetty/io/RetainableByteBuffer.java | 4 +- .../io/content/InputStreamContentSource.java | 14 +++---- .../jetty/io/content/PathContentSource.java | 8 ++-- .../io/ssl/SslClientConnectionFactory.java | 14 +++---- .../eclipse/jetty/io/ssl/SslConnection.java | 12 +++--- .../jetty/io/ByteBufferAccumulatorTest.java | 2 +- .../jetty/io/SocketChannelEndPointTest.java | 2 +- .../eclipse/jetty/io/SslConnectionTest.java | 2 +- .../ForwardProxyWithDynamicTransportTest.java | 8 ++-- .../quic/client/ClientQuicConnection.java | 4 +- .../jetty/quic/client/ClientQuicSession.java | 6 +-- .../jetty/quic/common/QuicConnection.java | 8 ++-- .../jetty/quic/common/QuicSession.java | 14 +++---- .../quic/server/QuicServerConnector.java | 4 +- .../quic/server/ServerQuicConnection.java | 6 +-- .../jetty/quic/server/ServerQuicSession.java | 4 +- .../jetty/server/AbstractConnector.java | 14 +++---- .../server/AbstractNetworkConnector.java | 4 +- .../org/eclipse/jetty/server/Components.java | 4 +- .../jetty/server/ConnectionMetaData.java | 2 +- .../org/eclipse/jetty/server/Connector.java | 6 +-- .../server/DetectorConnectionFactory.java | 2 +- .../eclipse/jetty/server/LocalConnector.java | 4 +- .../server/NetworkTrafficServerConnector.java | 4 +- .../jetty/server/ProxyConnectionFactory.java | 4 +- .../eclipse/jetty/server/ResourceService.java | 4 +- .../java/org/eclipse/jetty/server/Server.java | 8 ++-- .../eclipse/jetty/server/ServerConnector.java | 4 +- .../jetty/server/SslConnectionFactory.java | 6 +-- .../handler/BufferedResponseHandler.java | 6 +-- .../jetty/server/handler/ConnectHandler.java | 24 +++++------ .../jetty/server/handler/ErrorProcessor.java | 2 +- .../jetty/server/handler/ResourceHandler.java | 18 ++++----- .../server/handler/gzip/GzipRequest.java | 6 +-- .../handler/gzip/GzipResponseAndCallback.java | 2 +- .../server/internal/HttpChannelState.java | 6 +-- .../jetty/server/internal/HttpConnection.java | 6 +-- .../jetty/server/HttpServerTestBase.java | 4 +- .../eclipse/jetty/server/MockConnector.java | 4 +- .../jetty/server/ThreadStarvationTest.java | 4 +- .../server/handler/DebugHandlerTest.java | 4 +- .../server/handler/ResourceHandlerTest.java | 2 +- .../jetty/server/ssl/SSLEngineTest.java | 2 +- .../ssl/ServerConnectorSslServerTest.java | 4 +- .../ForwardProxyWithDynamicTransportTest.java | 8 ++-- .../transport/HttpClientDemandTest.java | 4 +- .../client/transport/HttpClientLoadTest.java | 4 +- .../transport/HttpClientTimeoutTest.java | 6 +-- .../server/UnixDomainServerConnector.java | 4 +- .../util/thread/ReservedThreadExecutor.java | 3 +- .../core/client/CoreClientUpgradeRequest.java | 4 +- .../websocket/core/AbstractExtension.java | 8 ++-- .../jetty/websocket/core/CoreSession.java | 8 ++-- .../websocket/core/WebSocketComponents.java | 12 +++--- .../core/internal/FrameCaptureExtension.java | 2 +- .../websocket/core/internal/FrameFlusher.java | 6 +-- .../jetty/websocket/core/internal/Parser.java | 8 ++-- .../internal/PerMessageDeflateExtension.java | 4 +- .../core/internal/WebSocketConnection.java | 22 +++++----- .../core/internal/WebSocketCoreSession.java | 6 +-- .../messages/ByteBufferMessageSink.java | 4 +- .../messages/MessageOutputStream.java | 4 +- .../core/internal/messages/MessageWriter.java | 4 +- .../server/WebSocketServerComponents.java | 12 +++--- .../server/internal/AbstractHandshaker.java | 6 +-- .../server/internal/RFC6455Handshaker.java | 6 +-- .../server/internal/RFC8441Handshaker.java | 6 +-- .../core/GeneratorParserRoundTripTest.java | 4 +- .../websocket/core/MessageHandlerTest.java | 6 +-- .../jetty/websocket/core/ParserCapture.java | 2 +- .../jetty/websocket/core/WebSocketTester.java | 4 +- .../core/internal/FrameFlusherTest.java | 8 ++-- .../core/util/MessageWriterTest.java | 4 +- .../annotations/TestAnnotationParser.java | 1 - .../maven/plugin/MavenServerConnector.java | 6 +-- .../test/TestJettyOSGiAnnotationParser.java | 1 - .../ee10/proxy/AsyncMiddleManServlet.java | 4 +- .../jetty/ee10/servlet/DefaultServlet.java | 12 +++--- .../jetty/ee10/servlet/HttpOutput.java | 6 +-- .../jdbc/ReloadedSessionMissingClassTest.java | 1 - .../common/JakartaWebSocketContainer.java | 6 +-- .../JakartaWebSocketRemoteEndpoint.java | 4 +- .../jakarta/common/AbstractSessionTest.java | 6 +-- .../common/messages/MessageWriterTest.java | 4 +- .../websocket/jakarta/tests/LocalServer.java | 4 +- .../websocket/client/WebSocketClient.java | 6 +-- .../common/MessageOutputStreamTest.java | 4 +- .../common/OutgoingMessageCapture.java | 6 +-- .../maven/plugin/MavenServerConnector.java | 6 +-- .../eclipse/jetty/ee9/nested/HttpChannel.java | 6 +-- .../eclipse/jetty/ee9/nested/HttpOutput.java | 10 ++--- .../jetty/ee9/nested/ResourceHandler.java | 14 +++---- .../jetty/ee9/nested/MockConnector.java | 2 +- .../test/TestJettyOSGiAnnotationParser.java | 1 - .../ee9/proxy/AsyncMiddleManServlet.java | 4 +- .../jetty/ee9/servlet/DefaultServlet.java | 12 +++--- .../jdbc/ReloadedSessionMissingClassTest.java | 1 - .../common/JakartaWebSocketContainer.java | 6 +-- .../JakartaWebSocketRemoteEndpoint.java | 4 +- .../jakarta/common/AbstractSessionTest.java | 6 +-- .../common/messages/MessageWriterTest.java | 4 +- .../websocket/jakarta/tests/LocalServer.java | 4 +- .../ee9/websocket/client/WebSocketClient.java | 6 +-- .../common/MessageOutputStreamTest.java | 4 +- .../common/OutgoingMessageCapture.java | 6 +-- pom.xml | 37 +++++++++++++++++ 236 files changed, 857 insertions(+), 826 deletions(-) rename jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/{RetainableByteBufferPool.java => ByteBufferPool.java} (92%) diff --git a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/ClientConnectorDocs.java b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/ClientConnectorDocs.java index 3cbb717b3919..e75148d384b4 100644 --- a/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/ClientConnectorDocs.java +++ b/documentation/jetty-documentation/src/main/java/org/eclipse/jetty/docs/programming/client/ClientConnectorDocs.java @@ -387,7 +387,7 @@ public void writeLine(String line, Callback callback) // Wrap the "telnet" ClientConnectionFactory with the SslClientConnectionFactory. connectionFactory = new SslClientConnectionFactory(clientConnector.getSslContextFactory(), - clientConnector.getRetainableByteBufferPool(), clientConnector.getExecutor(), connectionFactory); + clientConnector.getByteBufferPool(), clientConnector.getExecutor(), connectionFactory); // We will obtain a SslConnection now. CompletableFuture connectionPromise = new Promise.Completable<>(); diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java index a6fb97ff50e0..d881149e840c 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java @@ -52,7 +52,7 @@ protected void doStart() throws Exception { HttpClient httpClient = getHttpClient(); connector.setBindAddress(httpClient.getBindAddress()); - connector.setRetainableByteBufferPool(httpClient.getRetainableByteBufferPool()); + connector.setByteBufferPool(httpClient.getByteBufferPool()); connector.setConnectBlocking(httpClient.isConnectBlocking()); connector.setConnectTimeout(Duration.ofMillis(httpClient.getConnectTimeout())); connector.setExecutor(httpClient.getExecutor()); diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/GZIPContentDecoder.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/GZIPContentDecoder.java index aa09fa56785c..2f8467b8ebce 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/GZIPContentDecoder.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/GZIPContentDecoder.java @@ -13,8 +13,8 @@ package org.eclipse.jetty.client; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; /** * {@link ContentDecoder} for the "gzip" encoding. @@ -33,9 +33,9 @@ public GZIPContentDecoder(int bufferSize) this(null, bufferSize); } - public GZIPContentDecoder(RetainableByteBufferPool retainableByteBufferPool, int bufferSize) + public GZIPContentDecoder(ByteBufferPool byteBufferPool, int bufferSize) { - super(retainableByteBufferPool, bufferSize); + super(byteBufferPool, bufferSize); } @Override @@ -50,7 +50,7 @@ protected boolean decodedChunk(RetainableByteBuffer chunk) */ public static class Factory extends ContentDecoder.Factory { - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private final int bufferSize; public Factory() @@ -63,22 +63,22 @@ public Factory(int bufferSize) this(null, bufferSize); } - public Factory(RetainableByteBufferPool retainableByteBufferPool) + public Factory(ByteBufferPool byteBufferPool) { - this(retainableByteBufferPool, DEFAULT_BUFFER_SIZE); + this(byteBufferPool, DEFAULT_BUFFER_SIZE); } - public Factory(RetainableByteBufferPool retainableByteBufferPool, int bufferSize) + public Factory(ByteBufferPool byteBufferPool, int bufferSize) { super("gzip"); - this.retainableByteBufferPool = retainableByteBufferPool; + this.byteBufferPool = byteBufferPool; this.bufferSize = bufferSize; } @Override public ContentDecoder newContentDecoder() { - return new GZIPContentDecoder(retainableByteBufferPool, bufferSize); + return new GZIPContentDecoder(byteBufferPool, bufferSize); } } } diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java index 45736485e0d4..7e392facf31c 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClient.java @@ -49,9 +49,9 @@ import org.eclipse.jetty.http.HttpParser; import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; import org.eclipse.jetty.util.Fields; import org.eclipse.jetty.util.Jetty; @@ -199,9 +199,9 @@ protected void doStart() throws Exception int maxBucketSize = executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool)executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2; - RetainableByteBufferPool retainableByteBufferPool = getRetainableByteBufferPool(); - if (retainableByteBufferPool == null) - setRetainableByteBufferPool(new ArrayRetainableByteBufferPool(0, 2048, 65536, maxBucketSize)); + ByteBufferPool byteBufferPool = getByteBufferPool(); + if (byteBufferPool == null) + setByteBufferPool(new ArrayRetainableByteBufferPool(0, 2048, 65536, maxBucketSize)); Scheduler scheduler = getScheduler(); if (scheduler == null) { @@ -220,7 +220,7 @@ protected void doStart() throws Exception handlers.put(new ProxyAuthenticationProtocolHandler(this)); handlers.put(new UpgradeProtocolHandler()); - decoderFactories.put(new GZIPContentDecoder.Factory(retainableByteBufferPool)); + decoderFactories.put(new GZIPContentDecoder.Factory(byteBufferPool)); cookieManager = newCookieManager(); cookieStore = cookieManager.getCookieStore(); @@ -646,19 +646,19 @@ public ProtocolHandler findProtocolHandler(Request request, Response response) } /** - * @return the {@link RetainableByteBufferPool} of this HttpClient + * @return the {@link ByteBufferPool} of this HttpClient */ - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return connector.getRetainableByteBufferPool(); + return connector.getByteBufferPool(); } /** - * @param retainableByteBufferPool the {@link RetainableByteBufferPool} of this HttpClient + * @param byteBufferPool the {@link ByteBufferPool} of this HttpClient */ - public void setRetainableByteBufferPool(RetainableByteBufferPool retainableByteBufferPool) + public void setByteBufferPool(ByteBufferPool byteBufferPool) { - connector.setRetainableByteBufferPool(retainableByteBufferPool); + connector.setByteBufferPool(byteBufferPool); } /** @@ -1152,6 +1152,6 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory); + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory); } } diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/InputStreamRequestContent.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/InputStreamRequestContent.java index f9be0ff11504..4978329d2de4 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/InputStreamRequestContent.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/InputStreamRequestContent.java @@ -15,7 +15,7 @@ import java.io.InputStream; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.content.InputStreamContentSource; /** @@ -51,7 +51,7 @@ public InputStreamRequestContent(String contentType, InputStream stream) this(contentType, stream, null); } - public InputStreamRequestContent(String contentType, InputStream stream, RetainableByteBufferPool bufferPool) + public InputStreamRequestContent(String contentType, InputStream stream, ByteBufferPool bufferPool) { super(stream, bufferPool); this.contentType = contentType; diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/PathRequestContent.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/PathRequestContent.java index dc9ee8ed059e..2bcfcdab5830 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/PathRequestContent.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/PathRequestContent.java @@ -16,14 +16,14 @@ import java.io.IOException; import java.nio.file.Path; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.content.PathContentSource; /** *

A {@link Request.Content} for files using JDK 7's {@code java.nio.file} APIs.

*

It is possible to specify a buffer size used to read content from the stream, * by default 4096 bytes, whether the buffer should be direct or not, and a - * {@link RetainableByteBufferPool} from which {@code ByteBuffer}s will be acquired + * {@link ByteBufferPool} from which {@code ByteBuffer}s will be acquired * to read from the {@code Path}.

*/ public class PathRequestContent extends PathContentSource implements Request.Content @@ -51,7 +51,7 @@ public PathRequestContent(String contentType, Path filePath, int bufferSize) thr setBufferSize(bufferSize); } - public PathRequestContent(String contentType, Path filePath, RetainableByteBufferPool bufferPool) throws IOException + public PathRequestContent(String contentType, Path filePath, ByteBufferPool bufferPool) throws IOException { super(filePath, bufferPool); this.contentType = contentType; diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpReceiverOverHTTP.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpReceiverOverHTTP.java index 2aea64198057..7179677bff2d 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpReceiverOverHTTP.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpReceiverOverHTTP.java @@ -30,10 +30,10 @@ import org.eclipse.jetty.http.HttpParser; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Promise; import org.slf4j.Logger; @@ -45,7 +45,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res private final LongAdder inMessages = new LongAdder(); private final HttpParser parser; - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private RetainableByteBuffer networkBuffer; private boolean shutdown; private boolean complete; @@ -66,7 +66,7 @@ public HttpReceiverOverHTTP(HttpChannelOverHTTP channel) parser.setHeaderCacheSize(httpTransport.getHeaderCacheSize()); parser.setHeaderCacheCaseSensitive(httpTransport.isHeaderCacheCaseSensitive()); } - retainableByteBufferPool = httpClient.getRetainableByteBufferPool(); + byteBufferPool = httpClient.getByteBufferPool(); } void receive() @@ -197,7 +197,7 @@ private RetainableByteBuffer newNetworkBuffer() { HttpClient client = getHttpDestination().getHttpClient(); boolean direct = client.isUseInputDirectByteBuffers(); - return retainableByteBufferPool.acquire(client.getResponseBufferSize(), direct); + return byteBufferPool.acquire(client.getResponseBufferSize(), direct); } private void releaseNetworkBuffer() diff --git a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpSenderOverHTTP.java b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpSenderOverHTTP.java index f0fab73ed339..0d05cdf5e29d 100644 --- a/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpSenderOverHTTP.java +++ b/jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpSenderOverHTTP.java @@ -23,10 +23,10 @@ import org.eclipse.jetty.http.HttpGenerator; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.MetaData; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingCallback; @@ -158,7 +158,7 @@ private HeadersCallback() protected Action process() throws Exception { HttpClient httpClient = getHttpChannel().getHttpDestination().getHttpClient(); - RetainableByteBufferPool bufferPool = httpClient.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = httpClient.getByteBufferPool(); boolean useDirectByteBuffers = httpClient.isUseOutputDirectByteBuffers(); while (true) { @@ -289,7 +289,7 @@ public ContentCallback() protected Action process() throws Exception { HttpClient httpClient = getHttpChannel().getHttpDestination().getHttpClient(); - RetainableByteBufferPool bufferPool = httpClient.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = httpClient.getByteBufferPool(); boolean useDirectByteBuffers = httpClient.isUseOutputDirectByteBuffers(); while (true) { diff --git a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientGZIPTest.java b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientGZIPTest.java index c9824032702e..995a1e1b7163 100644 --- a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientGZIPTest.java +++ b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientGZIPTest.java @@ -28,8 +28,8 @@ import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.util.Callback; @@ -242,7 +242,7 @@ protected void service(Request request, org.eclipse.jetty.server.Response respon } }); - RetainableByteBufferPool pool = client.getRetainableByteBufferPool(); + ByteBufferPool pool = client.getByteBufferPool(); assumeTrue(pool instanceof ArrayRetainableByteBufferPool); ArrayRetainableByteBufferPool bufferPool = (ArrayRetainableByteBufferPool)pool; diff --git a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java index 74cd82f04e01..ed2a43d8fb3f 100644 --- a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java +++ b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTLSTest.java @@ -45,13 +45,13 @@ import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.ConnectionStatistics; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.io.ssl.SslHandshakeListener; @@ -630,7 +630,7 @@ public void testNeverUsedConnectionThenServerIdleTimeout() throws Exception @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - return new SslConnection(connector.getRetainableByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) + return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override protected int networkFill(ByteBuffer input) throws IOException @@ -664,10 +664,10 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory) + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory) { @Override - protected SslConnection newSslConnection(RetainableByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) + protected SslConnection newSslConnection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) { return new SslConnection(bufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @@ -721,7 +721,7 @@ public void testEncryptedInputBufferRepooling() throws Exception @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - RetainableByteBufferPool bufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connector.getByteBufferPool(); return new SslConnection(bufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override @@ -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.getRetainableByteBufferPool(); + ArrayRetainableByteBufferPool bufferPool = (ArrayRetainableByteBufferPool)server.getByteBufferPool(); Pool bucket = bufferPool.poolFor(16 * 1024 + 1, connector.getConnectionFactory(HttpConnectionFactory.class).isUseInputDirectByteBuffers()); assertEquals(1, bucket.size()); assertEquals(1, bucket.getIdleCount()); @@ -769,7 +769,7 @@ public void testEncryptedOutputBufferRepooling() throws Exception QueuedThreadPool serverThreads = new QueuedThreadPool(); serverThreads.setName("server"); List leakedBuffers = new CopyOnWriteArrayList<>(); - RetainableByteBufferPool bufferPool = new RetainableByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) + ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) { @Override public RetainableByteBuffer acquire(int size, boolean direct) @@ -798,7 +798,7 @@ public boolean release() @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - RetainableByteBufferPool bufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connector.getByteBufferPool(); return new SslConnection(bufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override @@ -839,7 +839,7 @@ public void testEncryptedOutputBufferRepoolingAfterNetworkFlushReturnsFalse(bool QueuedThreadPool serverThreads = new QueuedThreadPool(); serverThreads.setName("server"); List leakedBuffers = new CopyOnWriteArrayList<>(); - RetainableByteBufferPool bufferPool = new RetainableByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) + ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) { @Override public RetainableByteBuffer acquire(int size, boolean direct) @@ -869,7 +869,7 @@ public boolean release() @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - RetainableByteBufferPool bufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connector.getByteBufferPool(); return new SslConnection(bufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override @@ -924,7 +924,7 @@ public void testEncryptedOutputBufferRepoolingAfterNetworkFlushThrows(boolean cl QueuedThreadPool serverThreads = new QueuedThreadPool(); serverThreads.setName("server"); List leakedBuffers = new CopyOnWriteArrayList<>(); - RetainableByteBufferPool bufferPool = new RetainableByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) + ByteBufferPool bufferPool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) { @Override public RetainableByteBuffer acquire(int size, boolean direct) @@ -954,7 +954,7 @@ public boolean release() @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - RetainableByteBufferPool bufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connector.getByteBufferPool(); return new SslConnection(bufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override @@ -1017,7 +1017,7 @@ public void testNeverUsedConnectionThenClientIdleTimeout() throws Exception @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - return new SslConnection(connector.getRetainableByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) + return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override protected int networkFill(ByteBuffer input) throws IOException @@ -1052,10 +1052,10 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory) + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory) { @Override - protected SslConnection newSslConnection(RetainableByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) + protected SslConnection newSslConnection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) { return new SslConnection(bufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @@ -1114,10 +1114,10 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory) + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory) { @Override - protected SslConnection newSslConnection(RetainableByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) + protected SslConnection newSslConnection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) { return new SslConnection(bufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @@ -1158,7 +1158,7 @@ public void testTLSLargeFragments() throws Exception @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - return new SslConnection(connector.getRetainableByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) + return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override protected SSLEngineResult unwrap(SSLEngine sslEngine, ByteBuffer input, ByteBuffer output) throws SSLException @@ -1194,10 +1194,10 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory) + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory) { @Override - protected SslConnection newSslConnection(RetainableByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) + protected SslConnection newSslConnection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) { return new SslConnection(bufferPool, executor, endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { diff --git a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java index bfbd8a1e8a1b..ff8caa921c86 100644 --- a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java +++ b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java @@ -21,8 +21,8 @@ import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; import org.eclipse.jetty.io.ByteArrayEndPoint; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.BufferUtil; @@ -43,7 +43,7 @@ public void testSslConnectionClosedBeforeFill() throws Exception sslContextFactory.setKeyStorePassword("storepwd"); sslContextFactory.start(); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.start(); ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); diff --git a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartRequestContentTest.java b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartRequestContentTest.java index 198d054346f9..21bb2adfab45 100644 --- a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartRequestContentTest.java +++ b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/util/MultiPartRequestContentTest.java @@ -283,7 +283,7 @@ protected void process(MultiPartFormData.Parts parts) throws Exception }); MultiPartRequestContent multiPart = new MultiPartRequestContent(); - PathRequestContent content = new PathRequestContent(contentType, tmpPath, client.getRetainableByteBufferPool()); + PathRequestContent content = new PathRequestContent(contentType, tmpPath, client.getByteBufferPool()); content.setUseDirectByteBuffers(client.isUseOutputDirectByteBuffers()); multiPart.addPart(new MultiPart.ContentSourcePart(name, tmpPath.getFileName().toString(), null, content)); multiPart.close(); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpChannelOverFCGI.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpChannelOverFCGI.java index 950a15f19783..ebda62280b10 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpChannelOverFCGI.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpChannelOverFCGI.java @@ -24,9 +24,9 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.IdleTimeout; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Promise; import org.slf4j.Logger; @@ -162,7 +162,7 @@ else if (!connection.closeByHTTP(responseHeaders)) release(); } - protected void flush(RetainableByteBufferPool.Accumulator accumulator, Callback callback) + protected void flush(ByteBufferPool.Accumulator accumulator, Callback callback) { flusher.flush(accumulator, callback); } diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpConnectionOverFCGI.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpConnectionOverFCGI.java index e036b6558c23..21f0c41c7551 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpConnectionOverFCGI.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpConnectionOverFCGI.java @@ -42,10 +42,10 @@ import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeaderValue; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.Attachable; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Promise; @@ -57,7 +57,7 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements IConne { private static final Logger LOG = LoggerFactory.getLogger(HttpConnectionOverFCGI.class); - private final RetainableByteBufferPool networkByteBufferPool; + private final ByteBufferPool networkByteBufferPool; private final AutoLock lock = new AutoLock(); private final LinkedList requests = new LinkedList<>(); private final AtomicBoolean closed = new AtomicBoolean(); @@ -81,7 +81,7 @@ public HttpConnectionOverFCGI(EndPoint endPoint, Destination destination, Promis this.parser = new ClientParser(new ResponseListener()); requests.addLast(0); HttpClient client = destination.getHttpClient(); - this.networkByteBufferPool = client.getRetainableByteBufferPool(); + this.networkByteBufferPool = client.getByteBufferPool(); } public HttpDestination getHttpDestination() diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpSenderOverFCGI.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpSenderOverFCGI.java index 2b500d0de69a..3e1fc3862321 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpSenderOverFCGI.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpSenderOverFCGI.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Jetty; import org.eclipse.jetty.util.StringUtil; @@ -42,7 +42,7 @@ public HttpSenderOverFCGI(HttpChannel channel) { super(channel); HttpClient httpClient = channel.getHttpDestination().getHttpClient(); - this.generator = new ClientGenerator(httpClient.getRetainableByteBufferPool(), httpClient.isUseOutputDirectByteBuffers()); + this.generator = new ClientGenerator(httpClient.getByteBufferPool(), httpClient.isUseOutputDirectByteBuffers()); } @Override @@ -98,7 +98,7 @@ protected void sendHeaders(HttpExchange exchange, ByteBuffer contentBuffer, bool HttpClientTransportOverFCGI transport = (HttpClientTransportOverFCGI)getHttpChannel().getHttpDestination().getHttpClient().getTransport(); transport.customize(request, fcgiHeaders); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); int id = getHttpChannel().getRequest(); if (contentBuffer.hasRemaining() || lastContent) { @@ -117,7 +117,7 @@ protected void sendContent(HttpExchange exchange, ByteBuffer contentBuffer, bool { if (contentBuffer.hasRemaining() || lastContent) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); int request = getHttpChannel().getRequest(); generator.generateRequestContent(accumulator, request, contentBuffer, lastContent); getHttpChannel().flush(accumulator, callback); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ClientGenerator.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ClientGenerator.java index 7688c3fff655..9eeb330b4109 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ClientGenerator.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ClientGenerator.java @@ -22,8 +22,8 @@ import org.eclipse.jetty.fcgi.FCGI; import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class ClientGenerator extends Generator @@ -33,17 +33,17 @@ public class ClientGenerator extends Generator // 0x7F_FF - 4 (the 4 is to make room for the name (or value) length). public static final int MAX_PARAM_LENGTH = 0x7F_FF - 4; - public ClientGenerator(RetainableByteBufferPool bufferPool) + public ClientGenerator(ByteBufferPool bufferPool) { this(bufferPool, true); } - public ClientGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public ClientGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { super(bufferPool, useDirectByteBuffers); } - public void generateRequestHeaders(RetainableByteBufferPool.Accumulator accumulator, int request, HttpFields fields) + public void generateRequestHeaders(ByteBufferPool.Accumulator accumulator, int request, HttpFields fields) { request &= 0xFF_FF; @@ -79,7 +79,7 @@ public void generateRequestHeaders(RetainableByteBufferPool.Accumulator accumula // One FCGI_BEGIN_REQUEST + N FCGI_PARAMS + one last FCGI_PARAMS - RetainableByteBuffer beginBuffer = getRetainableByteBufferPool().acquire(16, isUseDirectByteBuffers()); + RetainableByteBuffer beginBuffer = getByteBufferPool().acquire(16, isUseDirectByteBuffers()); accumulator.append(beginBuffer); ByteBuffer beginByteBuffer = beginBuffer.getByteBuffer(); BufferUtil.clearToFill(beginByteBuffer); @@ -95,7 +95,7 @@ public void generateRequestHeaders(RetainableByteBufferPool.Accumulator accumula while (fieldsLength > 0) { int capacity = 8 + Math.min(maxCapacity, fieldsLength); - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(capacity, isUseDirectByteBuffers()); + RetainableByteBuffer buffer = getByteBufferPool().acquire(capacity, isUseDirectByteBuffers()); accumulator.append(buffer); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); @@ -133,7 +133,7 @@ public void generateRequestHeaders(RetainableByteBufferPool.Accumulator accumula BufferUtil.flipToFlush(byteBuffer, 0); } - RetainableByteBuffer lastBuffer = getRetainableByteBufferPool().acquire(8, isUseDirectByteBuffers()); + RetainableByteBuffer lastBuffer = getByteBufferPool().acquire(8, isUseDirectByteBuffers()); accumulator.append(lastBuffer); ByteBuffer lastByteBuffer = lastBuffer.getByteBuffer(); BufferUtil.clearToFill(lastByteBuffer); @@ -159,7 +159,7 @@ private int bytesForLength(int length) return length > 127 ? 4 : 1; } - public void generateRequestContent(RetainableByteBufferPool.Accumulator accumulator, int request, ByteBuffer content, boolean lastContent) + public void generateRequestContent(ByteBufferPool.Accumulator accumulator, int request, ByteBuffer content, boolean lastContent) { generateContent(accumulator, request, content, lastContent, FCGI.FrameType.STDIN); } diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Flusher.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Flusher.java index 58ebcb0e74df..6f5d67218110 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Flusher.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Flusher.java @@ -18,8 +18,8 @@ import java.util.List; import java.util.Queue; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingCallback; import org.eclipse.jetty.util.thread.AutoLock; @@ -40,7 +40,7 @@ public Flusher(EndPoint endPoint) this.endPoint = endPoint; } - public void flush(RetainableByteBufferPool.Accumulator accumulator, Callback callback) + public void flush(ByteBufferPool.Accumulator accumulator, Callback callback) { offer(new Entry(accumulator, callback)); flushCallback.iterate(); @@ -126,7 +126,7 @@ public void onCompleteFailure(Throwable x) } } - private record Entry(RetainableByteBufferPool.Accumulator accumulator, Callback callback) implements Callback + private record Entry(ByteBufferPool.Accumulator accumulator, Callback callback) implements Callback { @Override public void succeeded() diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Generator.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Generator.java index 9031b2c8eeda..db69cd3ca8a6 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Generator.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/Generator.java @@ -16,24 +16,24 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.fcgi.FCGI; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class Generator { public static final int MAX_CONTENT_LENGTH = 0xFF_FF; - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final boolean useDirectByteBuffers; - public Generator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public Generator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { this.bufferPool = bufferPool; this.useDirectByteBuffers = useDirectByteBuffers; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } @@ -43,7 +43,7 @@ public boolean isUseDirectByteBuffers() return useDirectByteBuffers; } - protected void generateContent(RetainableByteBufferPool.Accumulator accumulator, int id, ByteBuffer content, boolean lastContent, FCGI.FrameType frameType) + protected void generateContent(ByteBufferPool.Accumulator accumulator, int id, ByteBuffer content, boolean lastContent, FCGI.FrameType frameType) { id &= 0xFF_FF; @@ -51,7 +51,7 @@ protected void generateContent(RetainableByteBufferPool.Accumulator accumulator, while (contentLength > 0 || lastContent) { - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(8, isUseDirectByteBuffers()); + RetainableByteBuffer buffer = getByteBufferPool().acquire(8, isUseDirectByteBuffers()); accumulator.append(buffer); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ServerGenerator.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ServerGenerator.java index de752e0335f2..c1cc2d166cc6 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ServerGenerator.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/generator/ServerGenerator.java @@ -23,8 +23,8 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpStatus; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class ServerGenerator extends Generator @@ -35,18 +35,18 @@ public class ServerGenerator extends Generator private final boolean sendStatus200; - public ServerGenerator(RetainableByteBufferPool bufferPool) + public ServerGenerator(ByteBufferPool bufferPool) { this(bufferPool, true, true); } - public ServerGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers, boolean sendStatus200) + public ServerGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers, boolean sendStatus200) { super(bufferPool, useDirectByteBuffers); this.sendStatus200 = sendStatus200; } - public void generateResponseHeaders(RetainableByteBufferPool.Accumulator accumulator, int request, int code, String reason, HttpFields fields) + public void generateResponseHeaders(ByteBufferPool.Accumulator accumulator, int request, int code, String reason, HttpFields fields) { request &= 0xFF_FF; @@ -97,7 +97,7 @@ public void generateResponseHeaders(RetainableByteBufferPool.Accumulator accumul generateContent(accumulator, request, byteBuffer, false, FCGI.FrameType.STDOUT); } - public void generateResponseContent(RetainableByteBufferPool.Accumulator accumulator, int request, ByteBuffer content, boolean lastContent, boolean aborted) + public void generateResponseContent(ByteBufferPool.Accumulator accumulator, int request, ByteBuffer content, boolean lastContent, boolean aborted) { if (aborted) { @@ -117,7 +117,7 @@ public void generateResponseContent(RetainableByteBufferPool.Accumulator accumul private RetainableByteBuffer generateEndRequest(int request, boolean aborted) { request &= 0xFF_FF; - RetainableByteBuffer endRequestBuffer = getRetainableByteBufferPool().acquire(16, isUseDirectByteBuffers()); + RetainableByteBuffer endRequestBuffer = getByteBufferPool().acquire(16, isUseDirectByteBuffers()); ByteBuffer byteBuffer = endRequestBuffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.putInt(0x01_03_00_00 + request); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/generator/ClientGeneratorTest.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/generator/ClientGeneratorTest.java index 4ffe773ba975..b7693f41dc0d 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/generator/ClientGeneratorTest.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/generator/ClientGeneratorTest.java @@ -22,7 +22,7 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -59,9 +59,9 @@ public void testGenerateRequestHeaders() String longLongValue = new String(chars); fields.put(new HttpField(longLongName, longLongValue)); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ClientGenerator generator = new ClientGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); int id = 13; generator.generateRequestHeaders(accumulator, id, fields); @@ -157,9 +157,9 @@ private void testGenerateRequestContent(int contentLength) throws Exception { ByteBuffer content = ByteBuffer.allocate(contentLength); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ClientGenerator generator = new ClientGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); int id = 13; generator.generateRequestContent(accumulator, id, content, true); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/parser/ClientParserTest.java b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/parser/ClientParserTest.java index 64f2b48e52af..246121d84274 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/parser/ClientParserTest.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-client/src/test/java/org/eclipse/jetty/fcgi/parser/ClientParserTest.java @@ -23,7 +23,7 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -44,9 +44,9 @@ public void testParseResponseHeaders() String contentTypeValue = "text/html;charset=utf-8"; fields.put(contentTypeName, contentTypeValue); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ServerGenerator generator = new ServerGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateResponseHeaders(accumulator, id, statusCode, statusMessage, fields); // Use the fundamental theorem of arithmetic to test the results. @@ -108,9 +108,9 @@ public void testParseNoResponseContent() throws Exception HttpFields fields = HttpFields.build() .put("Content-Length", "0"); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ServerGenerator generator = new ServerGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateResponseHeaders(accumulator, id, 200, "OK", fields); generator.generateResponseContent(accumulator, id, null, true, false); @@ -158,9 +158,9 @@ public void testParseSmallResponseContent() throws Exception String contentTypeValue = String.valueOf(contentLength); fields.put(contentTypeName, contentTypeValue); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ServerGenerator generator = new ServerGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateResponseHeaders(accumulator, id, code, "OK", fields); generator.generateResponseContent(accumulator, id, content, true, false); @@ -209,9 +209,9 @@ public void testParseLargeResponseContent() throws Exception String contentTypeValue = String.valueOf(contentLength); fields.put(contentTypeName, contentTypeValue); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); ServerGenerator generator = new ServerGenerator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateResponseHeaders(accumulator, id, code, "OK", fields); generator.generateResponseContent(accumulator, id, content, true, false); diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/HttpStreamOverFCGI.java b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/HttpStreamOverFCGI.java index 964ade042da4..b4a185e774bb 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/HttpStreamOverFCGI.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/HttpStreamOverFCGI.java @@ -28,8 +28,8 @@ import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MetaData; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.HttpChannel; import org.eclipse.jetty.server.HttpStream; import org.eclipse.jetty.util.BufferUtil; @@ -229,7 +229,7 @@ public void send(MetaData.Request request, MetaData.Response response, boolean l { if (last) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generateResponseContent(accumulator, true, BufferUtil.EMPTY_BUFFER); flusher.flush(accumulator, callback); } @@ -241,7 +241,7 @@ public void send(MetaData.Request request, MetaData.Response response, boolean l } else { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generateResponseContent(accumulator, last, content); flusher.flush(accumulator, callback); } @@ -260,8 +260,8 @@ private void commit(MetaData.Response info, boolean head, boolean last, ByteBuff boolean shutdown = _shutdown = info.getFields().contains(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString()); - RetainableByteBufferPool bufferPool = _generator.getRetainableByteBufferPool(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool bufferPool = _generator.getByteBufferPool(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); Flusher flusher = _connection.getFlusher(); if (head) { @@ -288,12 +288,12 @@ private void commit(MetaData.Response info, boolean head, boolean last, ByteBuff flusher.shutdown(); } - private void generateResponseHeaders(RetainableByteBufferPool.Accumulator accumulator, MetaData.Response info) + private void generateResponseHeaders(ByteBufferPool.Accumulator accumulator, MetaData.Response info) { _generator.generateResponseHeaders(accumulator, _id, info.getStatus(), info.getReason(), info.getFields()); } - private void generateResponseContent(RetainableByteBufferPool.Accumulator accumulator, boolean last, ByteBuffer buffer) + private void generateResponseContent(ByteBufferPool.Accumulator accumulator, boolean last, ByteBuffer buffer) { _generator.generateResponseContent(accumulator, _id, buffer, last, _aborted); } diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/ServerFCGIConnection.java b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/ServerFCGIConnection.java index c1c6fc75eba1..79949e4016b8 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/ServerFCGIConnection.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/internal/ServerFCGIConnection.java @@ -26,11 +26,11 @@ import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpChannel; @@ -48,7 +48,7 @@ public class ServerFCGIConnection extends AbstractConnection implements Connecti private final HttpChannel.Factory httpChannelFactory = new HttpChannel.DefaultFactory(); private final Attributes attributes = new Lazy(); private final Connector connector; - private final RetainableByteBufferPool networkByteBufferPool; + private final ByteBufferPool networkByteBufferPool; private final boolean sendStatus200; private final Flusher flusher; private final HttpConfiguration configuration; @@ -63,7 +63,7 @@ public ServerFCGIConnection(Connector connector, EndPoint endPoint, HttpConfigur { super(endPoint, connector.getExecutor()); this.connector = connector; - this.networkByteBufferPool = connector.getRetainableByteBufferPool(); + this.networkByteBufferPool = connector.getByteBufferPool(); this.flusher = new Flusher(endPoint); this.configuration = configuration; this.sendStatus200 = sendStatus200; @@ -333,7 +333,7 @@ public void onStart(int request, FCGI.Role role, int flags) if (stream != null) throw new UnsupportedOperationException("FastCGI Multiplexing"); HttpChannel channel = httpChannelFactory.newHttpChannel(ServerFCGIConnection.this); - ServerGenerator generator = new ServerGenerator(connector.getRetainableByteBufferPool(), isUseOutputDirectByteBuffers(), sendStatus200); + ServerGenerator generator = new ServerGenerator(connector.getByteBufferPool(), isUseOutputDirectByteBuffers(), sendStatus200); stream = new HttpStreamOverFCGI(ServerFCGIConnection.this, generator, channel, request); channel.setHttpStream(stream); if (LOG.isDebugEnabled()) diff --git a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java index d35e81805b55..2764ed3d2cd3 100644 --- a/jetty-core/jetty-fcgi/jetty-fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java +++ b/jetty-core/jetty-fcgi/jetty-fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java @@ -22,8 +22,8 @@ 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.ByteBufferPool; import org.eclipse.jetty.io.ClientConnector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.Server; @@ -38,8 +38,8 @@ public abstract class AbstractHttpClientServerTest { - private RetainableByteBufferPool serverBufferPool; - protected RetainableByteBufferPool clientBufferPool; + private ByteBufferPool serverBufferPool; + protected ByteBufferPool clientBufferPool; private final AtomicLong connectionLeaks = new AtomicLong(); protected Server server; protected ServerConnector connector; @@ -68,7 +68,7 @@ public void start(Handler handler) throws Exception // TODO: restore leak tracking. if (clientBufferPool == null) clientBufferPool = new ArrayRetainableByteBufferPool(); - clientConnector.setRetainableByteBufferPool(clientBufferPool); + clientConnector.setByteBufferPool(clientBufferPool); HttpClientTransport transport = new HttpClientTransportOverFCGI(clientConnector, ""); transport.setConnectionPoolFactory(destination -> new LeakTrackingConnectionPool(destination, client.getMaxConnectionsPerDestination()) { diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java index b176ba3bb826..4e18315f5d4c 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/GZIPContentDecoder.java @@ -20,8 +20,8 @@ import java.util.zip.Inflater; import java.util.zip.ZipException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.component.Destroyable; import org.eclipse.jetty.util.compression.InflaterPool; @@ -37,7 +37,7 @@ public class GZIPContentDecoder implements Destroyable private static final long UINT_MAX = 0xFFFFFFFFL; private final List _inflateds = new ArrayList<>(); - private final RetainableByteBufferPool _pool; + private final ByteBufferPool _pool; private final int _bufferSize; private InflaterPool.Entry _inflaterEntry; private Inflater _inflater; @@ -57,17 +57,17 @@ public GZIPContentDecoder(int bufferSize) this(null, bufferSize); } - public GZIPContentDecoder(RetainableByteBufferPool retainableByteBufferPool, int bufferSize) + public GZIPContentDecoder(ByteBufferPool byteBufferPool, int bufferSize) { - this(new InflaterPool(0, true), retainableByteBufferPool, bufferSize); + this(new InflaterPool(0, true), byteBufferPool, bufferSize); } - public GZIPContentDecoder(InflaterPool inflaterPool, RetainableByteBufferPool retainableByteBufferPool, int bufferSize) + public GZIPContentDecoder(InflaterPool inflaterPool, ByteBufferPool byteBufferPool, int bufferSize) { _inflaterEntry = inflaterPool.acquire(); _inflater = _inflaterEntry.get(); _bufferSize = bufferSize; - _pool = retainableByteBufferPool != null ? retainableByteBufferPool : new RetainableByteBufferPool.NonPooling(); + _pool = byteBufferPool != null ? byteBufferPool : new ByteBufferPool.NonPooling(); reset(); } diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/CachingHttpContentFactory.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/CachingHttpContentFactory.java index 120e26ee903c..6268f2679204 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/CachingHttpContentFactory.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/CachingHttpContentFactory.java @@ -30,9 +30,9 @@ import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.PreEncodedHttpField; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Retainable; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.NanoTime; import org.eclipse.jetty.util.StringUtil; @@ -69,16 +69,16 @@ public class CachingHttpContentFactory implements HttpContent.Factory private final HttpContent.Factory _authority; private final ConcurrentHashMap _cache = new ConcurrentHashMap<>(); private final AtomicLong _cachedSize = new AtomicLong(); - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private int _maxCachedFileSize = DEFAULT_MAX_CACHED_FILE_SIZE; private int _maxCachedFiles = DEFAULT_MAX_CACHED_FILES; private long _maxCacheSize = DEFAULT_MAX_CACHE_SIZE; private boolean _useDirectByteBuffers = true; - public CachingHttpContentFactory(HttpContent.Factory authority, RetainableByteBufferPool bufferPool) + public CachingHttpContentFactory(HttpContent.Factory authority, ByteBufferPool bufferPool) { _authority = authority; - _bufferPool = bufferPool != null ? bufferPool : new RetainableByteBufferPool.NonPooling(); + _bufferPool = bufferPool != null ? bufferPool : new ByteBufferPool.NonPooling(); } protected ConcurrentMap getCache() diff --git a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/ValidatingCachingHttpContentFactory.java b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/ValidatingCachingHttpContentFactory.java index b3dea606cf70..953f48bccb79 100644 --- a/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/ValidatingCachingHttpContentFactory.java +++ b/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/ValidatingCachingHttpContentFactory.java @@ -19,7 +19,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.NanoTime; import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.thread.Scheduler; @@ -55,11 +55,11 @@ public class ValidatingCachingHttpContentFactory extends CachingHttpContentFacto * * @param authority the wrapped {@link HttpContent.Factory} to use. * @param validationPeriod time between filesystem checks in ms to see if an {@link HttpContent} is still valid (-1 never validate, 0 always validate). - * @param bufferPool the {@link org.eclipse.jetty.io.RetainableByteBufferPool} to use. + * @param bufferPool the {@link org.eclipse.jetty.io.ByteBufferPool} to use. */ public ValidatingCachingHttpContentFactory(@Name("authority") HttpContent.Factory authority, @Name("validationPeriod") long validationPeriod, - @Name("bufferPool") RetainableByteBufferPool bufferPool) + @Name("bufferPool") ByteBufferPool bufferPool) { this(authority, validationPeriod, bufferPool, null, -1, -1); } @@ -70,14 +70,14 @@ public ValidatingCachingHttpContentFactory(@Name("authority") HttpContent.Factor * * @param authority the wrapped {@link HttpContent.Factory} to use. * @param validationPeriod time between filesystem checks in ms to see if an {@link HttpContent} is still valid (-1 never validate, 0 always validate). - * @param bufferPool the {@link org.eclipse.jetty.io.RetainableByteBufferPool} to use. + * @param bufferPool the {@link org.eclipse.jetty.io.ByteBufferPool} to use. * @param scheduler scheduler to use for the sweeper, can be null to not use sweeper. * @param sweepPeriod time between runs of the sweeper in ms (if 0 never sweep for invalid entries). * @param idleTimeout amount of time in ms an entry can be unused before evicted by the sweeper (if 0 never evict unused entries). */ public ValidatingCachingHttpContentFactory(@Name("authority") HttpContent.Factory authority, @Name("validationPeriod") long validationPeriod, - @Name("byteBufferPool") RetainableByteBufferPool bufferPool, + @Name("byteBufferPool") ByteBufferPool bufferPool, @Name("scheduler") Scheduler scheduler, @Name("sweepPeriod") long sweepPeriod, @Name("idleTimeout") long idleTimeout) diff --git a/jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java b/jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java index 75e4161d4232..5c115ace46b3 100644 --- a/jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java +++ b/jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/GZIPContentDecoderTest.java @@ -24,8 +24,8 @@ import java.util.zip.GZIPOutputStream; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -42,12 +42,12 @@ public class GZIPContentDecoderTest { private final AtomicInteger counter = new AtomicInteger(); - private RetainableByteBufferPool pool; + private ByteBufferPool pool; @BeforeEach public void before() { - pool = new RetainableByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) + pool = new ByteBufferPool.Wrapper(new ArrayRetainableByteBufferPool()) { @Override public RetainableByteBuffer acquire(int size, boolean direct) diff --git a/jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/HttpClientTransportOverHTTP2.java b/jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/HttpClientTransportOverHTTP2.java index 5344ccc9efba..a81699b3d000 100644 --- a/jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/HttpClientTransportOverHTTP2.java +++ b/jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/HttpClientTransportOverHTTP2.java @@ -90,7 +90,7 @@ protected void doStart() throws Exception HttpClient httpClient = getHttpClient(); client.setExecutor(httpClient.getExecutor()); client.setScheduler(httpClient.getScheduler()); - client.setRetainableByteBufferPool(httpClient.getRetainableByteBufferPool()); + client.setByteBufferPool(httpClient.getByteBufferPool()); client.setConnectTimeout(httpClient.getConnectTimeout()); client.setIdleTimeout(httpClient.getIdleTimeout()); client.setInputBufferSize(httpClient.getResponseBufferSize()); diff --git a/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2Client.java b/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2Client.java index 2d488a23e8c9..368d3009d600 100644 --- a/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2Client.java +++ b/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2Client.java @@ -28,9 +28,9 @@ import org.eclipse.jetty.http2.api.Session; import org.eclipse.jetty.http2.frames.Frame; import org.eclipse.jetty.http2.frames.SettingsFrame; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.annotation.ManagedAttribute; @@ -153,14 +153,14 @@ public void setScheduler(Scheduler scheduler) connector.setScheduler(scheduler); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return connector.getRetainableByteBufferPool(); + return connector.getByteBufferPool(); } - public void setRetainableByteBufferPool(RetainableByteBufferPool bufferPool) + public void setByteBufferPool(ByteBufferPool bufferPool) { - connector.setRetainableByteBufferPool(bufferPool); + connector.setByteBufferPool(bufferPool); } public FlowControlStrategy.Factory getFlowControlStrategyFactory() @@ -435,7 +435,7 @@ private ClientConnectionFactory newClientConnectionFactory(SslContextFactory ssl { if (isUseALPN()) factory = new ALPNClientConnectionFactory(getExecutor(), factory, getProtocols()); - factory = new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), factory); + factory = new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), factory); } return factory; } diff --git a/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java b/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java index cf5453c3decc..1a7482fcfb75 100644 --- a/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java +++ b/jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java @@ -28,10 +28,10 @@ import org.eclipse.jetty.http2.frames.WindowUpdateFrame; import org.eclipse.jetty.http2.generator.Generator; import org.eclipse.jetty.http2.parser.Parser; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.thread.Scheduler; @@ -48,7 +48,7 @@ public class HTTP2ClientConnectionFactory implements ClientConnectionFactory public Connection newConnection(EndPoint endPoint, Map context) { HTTP2Client client = (HTTP2Client)context.get(CLIENT_CONTEXT_KEY); - RetainableByteBufferPool bufferPool = client.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = client.getByteBufferPool(); Executor executor = client.getExecutor(); Scheduler scheduler = client.getScheduler(); Session.Listener listener = (Session.Listener)context.get(SESSION_LISTENER_CONTEXT_KEY); @@ -81,9 +81,9 @@ private static class HTTP2ClientConnection extends HTTP2Connection implements Ca private final Promise promise; private final Session.Listener listener; - private HTTP2ClientConnection(HTTP2Client client, RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endpoint, Parser parser, HTTP2Session session, int bufferSize, Promise promise, Session.Listener listener) + private HTTP2ClientConnection(HTTP2Client client, ByteBufferPool byteBufferPool, Executor executor, EndPoint endpoint, Parser parser, HTTP2Session session, int bufferSize, Promise promise, Session.Listener listener) { - super(retainableByteBufferPool, executor, endpoint, parser, session, bufferSize); + super(byteBufferPool, executor, endpoint, parser, session, bufferSize); this.client = client; this.promise = promise; this.listener = listener; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java index c26d84f701bc..afca887f7a2c 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java @@ -24,11 +24,11 @@ import org.eclipse.jetty.http2.frames.DataFrame; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.Retainable; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.WriteFlusher; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; @@ -47,7 +47,7 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher. private final Queue tasks = new ArrayDeque<>(); private final HTTP2Producer producer = new HTTP2Producer(); private final AtomicLong bytesIn = new AtomicLong(); - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private final Parser parser; private final HTTP2Session session; private final int bufferSize; @@ -55,10 +55,10 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher. private boolean useInputDirectByteBuffers; private boolean useOutputDirectByteBuffers; - protected HTTP2Connection(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, Parser parser, HTTP2Session session, int bufferSize) + protected HTTP2Connection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, Parser parser, HTTP2Session session, int bufferSize) { super(endPoint, executor); - this.retainableByteBufferPool = retainableByteBufferPool; + this.byteBufferPool = byteBufferPool; this.parser = parser; this.session = session; this.bufferSize = bufferSize; @@ -450,7 +450,7 @@ private class NetworkBuffer implements Retainable private NetworkBuffer() { - delegate = retainableByteBufferPool.acquire(bufferSize, isUseInputDirectByteBuffers()); + delegate = byteBufferPool.acquire(bufferSize, isUseInputDirectByteBuffers()); } public ByteBuffer getBuffer() diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java index 5a890fedf33c..2eef1a1ed740 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java @@ -56,9 +56,9 @@ import org.eclipse.jetty.http2.hpack.HpackException; import org.eclipse.jetty.http2.internal.HTTP2Flusher; import org.eclipse.jetty.http2.parser.Parser; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.CyclicTimeouts; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.WriteFlusher; import org.eclipse.jetty.util.AtomicBiInteger; import org.eclipse.jetty.util.Atomics; @@ -1208,7 +1208,7 @@ public int getDataBytesRemaining() return 0; } - public abstract boolean generate(RetainableByteBufferPool.Accumulator accumulator) throws HpackException; + public abstract boolean generate(ByteBufferPool.Accumulator accumulator) throws HpackException; public abstract long onFlushed(long bytes) throws IOException; @@ -1295,7 +1295,7 @@ public int getFrameBytesGenerated() } @Override - public boolean generate(RetainableByteBufferPool.Accumulator accumulator) throws HpackException + public boolean generate(ByteBufferPool.Accumulator accumulator) throws HpackException { frameBytes = generator.control(accumulator, frame); beforeSend(); @@ -1409,7 +1409,7 @@ public int getDataBytesRemaining() } @Override - public boolean generate(RetainableByteBufferPool.Accumulator accumulator) + public boolean generate(ByteBufferPool.Accumulator accumulator) { int dataRemaining = getDataBytesRemaining(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/DataGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/DataGenerator.java index 9f6c2fc19e47..1afad970775e 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/DataGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/DataGenerator.java @@ -19,8 +19,8 @@ import org.eclipse.jetty.http2.frames.Frame; import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class DataGenerator @@ -32,12 +32,12 @@ public DataGenerator(HeaderGenerator headerGenerator) this.headerGenerator = headerGenerator; } - public int generate(RetainableByteBufferPool.Accumulator accumulator, DataFrame frame, int maxLength) + public int generate(ByteBufferPool.Accumulator accumulator, DataFrame frame, int maxLength) { return generateData(accumulator, frame.getStreamId(), frame.getByteBuffer(), frame.isEndStream(), maxLength); } - public int generateData(RetainableByteBufferPool.Accumulator accumulator, int streamId, ByteBuffer data, boolean last, int maxLength) + public int generateData(ByteBufferPool.Accumulator accumulator, int streamId, ByteBuffer data, boolean last, int maxLength) { if (streamId < 0) throw new IllegalArgumentException("Invalid stream id: " + streamId); @@ -62,7 +62,7 @@ public int generateData(RetainableByteBufferPool.Accumulator accumulator, int st return Frame.HEADER_LENGTH + length; } - private void generateFrame(RetainableByteBufferPool.Accumulator accumulator, int streamId, ByteBuffer data, boolean last) + private void generateFrame(ByteBufferPool.Accumulator accumulator, int streamId, ByteBuffer data, boolean last) { int length = data.remaining(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/FrameGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/FrameGenerator.java index f3d9c8c50958..a98d1e260aa5 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/FrameGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/FrameGenerator.java @@ -20,8 +20,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.hpack.HpackEncoder; import org.eclipse.jetty.http2.hpack.HpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public abstract class FrameGenerator @@ -33,7 +33,7 @@ protected FrameGenerator(HeaderGenerator headerGenerator) this.headerGenerator = headerGenerator; } - public abstract int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException; + public abstract int generate(ByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException; protected RetainableByteBuffer generateHeader(FrameType frameType, int length, int flags, int streamId) { @@ -52,7 +52,7 @@ public boolean isUseDirectByteBuffers() protected RetainableByteBuffer encode(HpackEncoder encoder, MetaData metaData, int maxFrameSize) throws HpackException { - RetainableByteBuffer hpacked = headerGenerator.getRetainableByteBufferPool().acquire(maxFrameSize, isUseDirectByteBuffers()); + RetainableByteBuffer hpacked = headerGenerator.getByteBufferPool().acquire(maxFrameSize, isUseDirectByteBuffers()); try { ByteBuffer byteBuffer = hpacked.getByteBuffer(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java index 51851cd2a3a8..e9b7e3e84172 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/Generator.java @@ -18,27 +18,27 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.hpack.HpackEncoder; import org.eclipse.jetty.http2.hpack.HpackException; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class Generator { - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final HeaderGenerator headerGenerator; private final HpackEncoder hpackEncoder; private final FrameGenerator[] generators; private final DataGenerator dataGenerator; - public Generator(RetainableByteBufferPool bufferPool) + public Generator(ByteBufferPool bufferPool) { this(bufferPool, 4096, 0); } - public Generator(RetainableByteBufferPool bufferPool, int maxDynamicTableSize, int maxHeaderBlockFragment) + public Generator(ByteBufferPool bufferPool, int maxDynamicTableSize, int maxHeaderBlockFragment) { this(bufferPool, true, maxDynamicTableSize, maxHeaderBlockFragment); } - public Generator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers, int maxDynamicTableSize, int maxHeaderBlockFragment) + public Generator(ByteBufferPool bufferPool, boolean useDirectByteBuffers, int maxDynamicTableSize, int maxHeaderBlockFragment) { this.bufferPool = bufferPool; @@ -61,7 +61,7 @@ public Generator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffe this.dataGenerator = new DataGenerator(headerGenerator); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } @@ -81,12 +81,12 @@ public void setMaxFrameSize(int maxFrameSize) headerGenerator.setMaxFrameSize(maxFrameSize); } - public int control(RetainableByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException + public int control(ByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException { return generators[frame.getType().getType()].generate(accumulator, frame); } - public int data(RetainableByteBufferPool.Accumulator accumulator, DataFrame frame, int maxLength) + public int data(ByteBufferPool.Accumulator accumulator, DataFrame frame, int maxLength) { return dataGenerator.generate(accumulator, frame, maxLength); } diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/GoAwayGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/GoAwayGenerator.java index f21540a3f153..1f24a9d78b67 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/GoAwayGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/GoAwayGenerator.java @@ -20,8 +20,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.GoAwayFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class GoAwayGenerator extends FrameGenerator @@ -32,13 +32,13 @@ public GoAwayGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { GoAwayFrame goAwayFrame = (GoAwayFrame)frame; return generateGoAway(accumulator, goAwayFrame.getLastStreamId(), goAwayFrame.getError(), goAwayFrame.getPayload()); } - public int generateGoAway(RetainableByteBufferPool.Accumulator accumulator, int lastStreamId, int error, byte[] payload) + public int generateGoAway(ByteBufferPool.Accumulator accumulator, int lastStreamId, int error, byte[] payload) { if (lastStreamId < 0) lastStreamId = 0; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeaderGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeaderGenerator.java index 0aebc36ed8a7..d9311756ea78 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeaderGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeaderGenerator.java @@ -17,28 +17,28 @@ import org.eclipse.jetty.http2.frames.Frame; import org.eclipse.jetty.http2.frames.FrameType; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class HeaderGenerator { private int maxFrameSize = Frame.DEFAULT_MAX_LENGTH; - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final boolean useDirectByteBuffers; - public HeaderGenerator(RetainableByteBufferPool bufferPool) + public HeaderGenerator(ByteBufferPool bufferPool) { this(bufferPool, true); } - public HeaderGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public HeaderGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { this.bufferPool = bufferPool; this.useDirectByteBuffers = useDirectByteBuffers; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } @@ -50,7 +50,7 @@ public boolean isUseDirectByteBuffers() public RetainableByteBuffer generate(FrameType frameType, int capacity, int length, int flags, int streamId) { - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(capacity, isUseDirectByteBuffers()); + RetainableByteBuffer buffer = getByteBufferPool().acquire(capacity, isUseDirectByteBuffers()); ByteBuffer header = buffer.getByteBuffer(); BufferUtil.clearToFill(header); header.put((byte)((length & 0x00_FF_00_00) >>> 16)); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeadersGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeadersGenerator.java index aa7bd877859d..449b197080e4 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeadersGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/HeadersGenerator.java @@ -23,8 +23,8 @@ import org.eclipse.jetty.http2.hpack.HpackEncoder; import org.eclipse.jetty.http2.hpack.HpackException; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class HeadersGenerator extends FrameGenerator @@ -47,13 +47,13 @@ public HeadersGenerator(HeaderGenerator headerGenerator, HpackEncoder encoder, i } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException { HeadersFrame headersFrame = (HeadersFrame)frame; return generateHeaders(accumulator, headersFrame.getStreamId(), headersFrame.getMetaData(), headersFrame.getPriority(), headersFrame.isEndStream()); } - public int generateHeaders(RetainableByteBufferPool.Accumulator accumulator, int streamId, MetaData metaData, PriorityFrame priority, boolean endStream) throws HpackException + public int generateHeaders(ByteBufferPool.Accumulator accumulator, int streamId, MetaData metaData, PriorityFrame priority, boolean endStream) throws HpackException { if (streamId < 0) throw new IllegalArgumentException("Invalid stream id: " + streamId); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/NoOpGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/NoOpGenerator.java index 0a59181c65c1..7f916f6417c9 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/NoOpGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/NoOpGenerator.java @@ -14,7 +14,7 @@ package org.eclipse.jetty.http2.generator; import org.eclipse.jetty.http2.frames.Frame; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class NoOpGenerator extends FrameGenerator { @@ -24,7 +24,7 @@ public NoOpGenerator() } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { return 0; } diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PingGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PingGenerator.java index 5eabde84d52e..d823cd1caaf1 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PingGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PingGenerator.java @@ -19,8 +19,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.PingFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class PingGenerator extends FrameGenerator @@ -31,13 +31,13 @@ public PingGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { PingFrame pingFrame = (PingFrame)frame; return generatePing(accumulator, pingFrame.getPayload(), pingFrame.isReply()); } - public int generatePing(RetainableByteBufferPool.Accumulator accumulator, byte[] payload, boolean reply) + public int generatePing(ByteBufferPool.Accumulator accumulator, byte[] payload, boolean reply) { if (payload.length != PingFrame.PING_LENGTH) throw new IllegalArgumentException("Invalid payload length: " + payload.length); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PrefaceGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PrefaceGenerator.java index e9d92c60c6c6..2f565529416a 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PrefaceGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PrefaceGenerator.java @@ -17,8 +17,8 @@ import org.eclipse.jetty.http2.frames.Frame; import org.eclipse.jetty.http2.frames.PrefaceFrame; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; public class PrefaceGenerator extends FrameGenerator { @@ -28,7 +28,7 @@ public PrefaceGenerator() } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { accumulator.append(RetainableByteBuffer.wrap(ByteBuffer.wrap(PrefaceFrame.PREFACE_BYTES))); return PrefaceFrame.PREFACE_BYTES.length; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PriorityGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PriorityGenerator.java index b72a0f39e1da..ee468e0558dc 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PriorityGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PriorityGenerator.java @@ -19,8 +19,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.PriorityFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class PriorityGenerator extends FrameGenerator @@ -31,13 +31,13 @@ public PriorityGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { PriorityFrame priorityFrame = (PriorityFrame)frame; return generatePriority(accumulator, priorityFrame.getStreamId(), priorityFrame.getParentStreamId(), priorityFrame.getWeight(), priorityFrame.isExclusive()); } - public int generatePriority(RetainableByteBufferPool.Accumulator accumulator, int streamId, int parentStreamId, int weight, boolean exclusive) + public int generatePriority(ByteBufferPool.Accumulator accumulator, int streamId, int parentStreamId, int weight, boolean exclusive) { RetainableByteBuffer header = generateHeader(FrameType.PRIORITY, PriorityFrame.PRIORITY_LENGTH, Flags.NONE, streamId); ByteBuffer byteBuffer = header.getByteBuffer(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PushPromiseGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PushPromiseGenerator.java index 9b2ee0394535..d08c0ebdb40b 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PushPromiseGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/PushPromiseGenerator.java @@ -22,8 +22,8 @@ import org.eclipse.jetty.http2.hpack.HpackEncoder; import org.eclipse.jetty.http2.hpack.HpackException; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class PushPromiseGenerator extends FrameGenerator @@ -37,13 +37,13 @@ public PushPromiseGenerator(HeaderGenerator headerGenerator, HpackEncoder encode } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) throws HpackException { PushPromiseFrame pushPromiseFrame = (PushPromiseFrame)frame; return generatePushPromise(accumulator, pushPromiseFrame.getStreamId(), pushPromiseFrame.getPromisedStreamId(), pushPromiseFrame.getMetaData()); } - public int generatePushPromise(RetainableByteBufferPool.Accumulator accumulator, int streamId, int promisedStreamId, MetaData metaData) throws HpackException + public int generatePushPromise(ByteBufferPool.Accumulator accumulator, int streamId, int promisedStreamId, MetaData metaData) throws HpackException { if (streamId < 0) throw new IllegalArgumentException("Invalid stream id: " + streamId); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/ResetGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/ResetGenerator.java index d77a59814bc2..f667f744b5a9 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/ResetGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/ResetGenerator.java @@ -19,8 +19,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.ResetFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class ResetGenerator extends FrameGenerator @@ -31,13 +31,13 @@ public ResetGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { ResetFrame resetFrame = (ResetFrame)frame; return generateReset(accumulator, resetFrame.getStreamId(), resetFrame.getError()); } - public int generateReset(RetainableByteBufferPool.Accumulator accumulator, int streamId, int error) + public int generateReset(ByteBufferPool.Accumulator accumulator, int streamId, int error) { if (streamId < 0) throw new IllegalArgumentException("Invalid stream id: " + streamId); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/SettingsGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/SettingsGenerator.java index 151d0a0599d7..86d4313123e3 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/SettingsGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/SettingsGenerator.java @@ -20,8 +20,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class SettingsGenerator extends FrameGenerator @@ -32,13 +32,13 @@ public SettingsGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { SettingsFrame settingsFrame = (SettingsFrame)frame; return generateSettings(accumulator, settingsFrame.getSettings(), settingsFrame.isReply()); } - public int generateSettings(RetainableByteBufferPool.Accumulator accumulator, Map settings, boolean reply) + public int generateSettings(ByteBufferPool.Accumulator accumulator, Map settings, boolean reply) { // Two bytes for the identifier, four bytes for the value. int entryLength = 2 + 4; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/WindowUpdateGenerator.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/WindowUpdateGenerator.java index 338e9723d915..8cd07a403918 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/WindowUpdateGenerator.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/generator/WindowUpdateGenerator.java @@ -19,8 +19,8 @@ import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.frames.WindowUpdateFrame; import org.eclipse.jetty.http2.internal.Flags; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class WindowUpdateGenerator extends FrameGenerator @@ -31,13 +31,13 @@ public WindowUpdateGenerator(HeaderGenerator headerGenerator) } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, Frame frame) + public int generate(ByteBufferPool.Accumulator accumulator, Frame frame) { WindowUpdateFrame windowUpdateFrame = (WindowUpdateFrame)frame; return generateWindowUpdate(accumulator, windowUpdateFrame.getStreamId(), windowUpdateFrame.getWindowDelta()); } - public int generateWindowUpdate(RetainableByteBufferPool.Accumulator accumulator, int streamId, int windowUpdate) + public int generateWindowUpdate(ByteBufferPool.Accumulator accumulator, int streamId, int windowUpdate) { if (windowUpdate < 0) throw new IllegalArgumentException("Invalid window update: " + windowUpdate); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/internal/HTTP2Flusher.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/internal/HTTP2Flusher.java index ea8c47721c3e..fcae58a20421 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/internal/HTTP2Flusher.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/internal/HTTP2Flusher.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.http2.HTTP2Stream; import org.eclipse.jetty.http2.frames.WindowUpdateFrame; import org.eclipse.jetty.http2.hpack.HpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EofException; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.IteratingCallback; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.thread.AutoLock; @@ -50,7 +50,7 @@ public class HTTP2Flusher extends IteratingCallback implements Dumpable private final Queue pendingEntries = new ArrayDeque<>(); private final Collection processedEntries = new ArrayList<>(); private final HTTP2Session session; - private final RetainableByteBufferPool.Accumulator accumulator; + private final ByteBufferPool.Accumulator accumulator; private InvocationType invocationType = InvocationType.NON_BLOCKING; private Throwable terminated; private HTTP2Session.Entry stalledEntry; @@ -58,7 +58,7 @@ public class HTTP2Flusher extends IteratingCallback implements Dumpable public HTTP2Flusher(HTTP2Session session) { this.session = session; - this.accumulator = new RetainableByteBufferPool.Accumulator(); + this.accumulator = new ByteBufferPool.Accumulator(); } @Override diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockFragments.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockFragments.java index 81540c87c30c..9e8df07b9f85 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockFragments.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockFragments.java @@ -16,19 +16,19 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http2.frames.PriorityFrame; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class HeaderBlockFragments { - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private PriorityFrame priorityFrame; private boolean endStream; private int streamId; private RetainableByteBuffer storage; - public HeaderBlockFragments(RetainableByteBufferPool bufferPool) + public HeaderBlockFragments(ByteBufferPool bufferPool) { this.bufferPool = bufferPool; } diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockParser.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockParser.java index bddf48e6e8a2..d06c2857ff2b 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockParser.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/HeaderBlockParser.java @@ -20,8 +20,8 @@ import org.eclipse.jetty.http2.ErrorCode; import org.eclipse.jetty.http2.hpack.HpackDecoder; import org.eclipse.jetty.http2.hpack.HpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,12 +33,12 @@ public class HeaderBlockParser private static final Logger LOG = LoggerFactory.getLogger(HeaderBlockParser.class); private final HeaderParser headerParser; - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final HpackDecoder hpackDecoder; private final BodyParser notifier; private RetainableByteBuffer blockBuffer; - public HeaderBlockParser(HeaderParser headerParser, RetainableByteBufferPool bufferPool, HpackDecoder hpackDecoder, BodyParser notifier) + public HeaderBlockParser(HeaderParser headerParser, ByteBufferPool bufferPool, HpackDecoder hpackDecoder, BodyParser notifier) { this.headerParser = headerParser; this.bufferPool = bufferPool; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/Parser.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/Parser.java index 33705de7a210..fb58a8bed372 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/Parser.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/Parser.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.http2.frames.WindowUpdateFrame; import org.eclipse.jetty.http2.hpack.HpackDecoder; import org.eclipse.jetty.http2.internal.Flags; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +44,7 @@ public class Parser { private static final Logger LOG = LoggerFactory.getLogger(Parser.class); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final Listener listener; private final HeaderParser headerParser; private final HpackDecoder hpackDecoder; @@ -55,12 +55,12 @@ public class Parser private boolean continuation; private State state = State.HEADER; - public Parser(RetainableByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize) + public Parser(ByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize) { this(bufferPool, listener, maxDynamicTableSize, maxHeaderSize, RateControl.NO_RATE_CONTROL); } - public Parser(RetainableByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize, RateControl rateControl) + public Parser(ByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize, RateControl rateControl) { this.bufferPool = bufferPool; this.listener = listener; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/ServerParser.java b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/ServerParser.java index a54eecd16c92..b58bf7b106e5 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/ServerParser.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/parser/ServerParser.java @@ -19,7 +19,7 @@ import org.eclipse.jetty.http2.RateControl; import org.eclipse.jetty.http2.frames.FrameType; import org.eclipse.jetty.http2.internal.Flags; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +33,7 @@ public class ServerParser extends Parser private State state = State.PREFACE; private boolean notifyPreface = true; - public ServerParser(RetainableByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize, RateControl rateControl) + public ServerParser(ByteBufferPool bufferPool, Listener listener, int maxDynamicTableSize, int maxHeaderSize, RateControl rateControl) { super(bufferPool, listener, maxDynamicTableSize, maxHeaderSize, rateControl); this.listener = listener; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ContinuationParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ContinuationParseTest.java index 985a9efce40d..bcec548afabe 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ContinuationParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ContinuationParseTest.java @@ -30,7 +30,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -42,7 +42,7 @@ public class ContinuationParseTest @Test public void testParseOneByteAtATime() throws Exception { - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); HeadersGenerator generator = new HeadersGenerator(new HeaderGenerator(bufferPool), new HpackEncoder()); final List frames = new ArrayList<>(); @@ -71,7 +71,7 @@ public void onConnectionFailure(int error, String reason) .put("User-Agent", "Jetty"); MetaData.Request metaData = new MetaData.Request("GET", HttpScheme.HTTP.asString(), new HostPortHttpField("localhost:8080"), "/path", HttpVersion.HTTP_2, fields, -1); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateHeaders(accumulator, streamId, metaData, null, true); List byteBuffers = accumulator.getByteBuffers(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java index 0f3be7446552..a80fa0a5293a 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/DataGenerateParseTest.java @@ -23,7 +23,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.Test; @@ -34,7 +34,7 @@ public class DataGenerateParseTest { private final byte[] smallContent = new byte[128]; private final byte[] largeContent = new byte[128 * 1024]; - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); public DataGenerateParseTest() { @@ -101,7 +101,7 @@ public void onData(DataFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); ByteBuffer slice = data.slice(); int generated = 0; while (true) @@ -141,7 +141,7 @@ public void onData(DataFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); ByteBuffer data = ByteBuffer.wrap(largeContent); ByteBuffer slice = data.slice(); int generated = 0; diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/FrameFloodTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/FrameFloodTest.java index e5b5a3d34f90..37582469cbff 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/FrameFloodTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/FrameFloodTest.java @@ -25,7 +25,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; @@ -33,7 +33,7 @@ public class FrameFloodTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); // Frame structure: // | Len0 | Len1 | Len2 | Type | Flags | StreamID0 |StreamID1 |StreamID2 |StreamID3 | Payload... | diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/GoAwayGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/GoAwayGenerateParseTest.java index 366f2a3c9107..6369f5c73663 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/GoAwayGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/GoAwayGenerateParseTest.java @@ -23,7 +23,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @@ -32,7 +32,7 @@ public class GoAwayGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -56,7 +56,7 @@ public void onGoAway(GoAwayFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateGoAway(accumulator, lastStreamId, error, null); frames.clear(); @@ -100,7 +100,7 @@ public void onGoAway(GoAwayFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateGoAway(accumulator, lastStreamId, error, payload); frames.clear(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersGenerateParseTest.java index 565de253996e..d76fcf3ee639 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersGenerateParseTest.java @@ -29,7 +29,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -38,7 +38,7 @@ public class HeadersGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -65,7 +65,7 @@ public void onHeaders(HeadersFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); PriorityFrame priorityFrame = new PriorityFrame(streamId, 3 * streamId, 200, true); generator.generateHeaders(accumulator, streamId, metaData, priorityFrame, true); @@ -124,7 +124,7 @@ public void onHeaders(HeadersFrame frame) .put("User-Agent", "Jetty"); MetaData.Request metaData = new MetaData.Request("GET", HttpScheme.HTTP.asString(), new HostPortHttpField("localhost:8080"), "/path", HttpVersion.HTTP_2, fields, -1); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); PriorityFrame priorityFrame = new PriorityFrame(streamId, 3 * streamId, 200, true); generator.generateHeaders(accumulator, streamId, metaData, priorityFrame, true); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersTooLargeParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersTooLargeParseTest.java index 6a43318bc6c3..e06d0875df2a 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersTooLargeParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/HeadersTooLargeParseTest.java @@ -29,7 +29,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -37,7 +37,7 @@ public class HeadersTooLargeParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testProtocolErrorURITooLong() throws HpackException @@ -78,7 +78,7 @@ public void onConnectionFailure(int error, String reason) parser.init(UnaryOperator.identity()); int streamId = 48; - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); PriorityFrame priorityFrame = new PriorityFrame(streamId, 3 * streamId, 200, true); int len = generator.generateHeaders(accumulator, streamId, metaData, priorityFrame, true); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/MaxFrameSizeParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/MaxFrameSizeParseTest.java index b73314b4625d..13bb120f15f8 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/MaxFrameSizeParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/MaxFrameSizeParseTest.java @@ -20,14 +20,14 @@ import org.eclipse.jetty.http2.ErrorCode; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +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 RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testMaxFrameSize() diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PingGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PingGenerateParseTest.java index 769c3a0522e6..064acd24552d 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PingGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PingGenerateParseTest.java @@ -23,7 +23,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.NanoTime; import org.junit.jupiter.api.Test; @@ -33,7 +33,7 @@ public class PingGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -57,7 +57,7 @@ public void onPing(PingFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePing(accumulator, payload, true); frames.clear(); @@ -98,7 +98,7 @@ public void onPing(PingFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePing(accumulator, payload, true); frames.clear(); @@ -133,7 +133,7 @@ public void onPing(PingFrame frame) }, 4096, 8192); parser.init(UnaryOperator.identity()); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); PingFrame ping = new PingFrame(NanoTime.now(), true); generator.generate(accumulator, ping); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PriorityGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PriorityGenerateParseTest.java index 79b26aa74c85..f335d591f071 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PriorityGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PriorityGenerateParseTest.java @@ -22,14 +22,14 @@ 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.RetainableByteBufferPool; +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 RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -55,7 +55,7 @@ public void onPriority(PriorityFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePriority(accumulator, streamId, parentStreamId, weight, exclusive); frames.clear(); @@ -100,7 +100,7 @@ public void onPriority(PriorityFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePriority(accumulator, streamId, parentStreamId, weight, exclusive); frames.clear(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PushPromiseGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PushPromiseGenerateParseTest.java index d2cbd0f5507b..45adb37b1392 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PushPromiseGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/PushPromiseGenerateParseTest.java @@ -29,7 +29,7 @@ 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.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -37,7 +37,7 @@ public class PushPromiseGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -65,7 +65,7 @@ public void onPushPromise(PushPromiseFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePushPromise(accumulator, streamId, promisedStreamId, metaData); frames.clear(); @@ -118,7 +118,7 @@ public void onPushPromise(PushPromiseFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generatePushPromise(accumulator, streamId, promisedStreamId, metaData); frames.clear(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ResetGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ResetGenerateParseTest.java index 4407a7597d3b..15161a3709a3 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ResetGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/ResetGenerateParseTest.java @@ -22,14 +22,14 @@ import org.eclipse.jetty.http2.generator.ResetGenerator; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class ResetGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -53,7 +53,7 @@ public void onReset(ResetFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateReset(accumulator, streamId, error); frames.clear(); @@ -94,7 +94,7 @@ public void onReset(ResetFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateReset(accumulator, streamId, error); frames.clear(); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/SettingsGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/SettingsGenerateParseTest.java index 3aee67e7e064..946c1780d600 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/SettingsGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/SettingsGenerateParseTest.java @@ -27,7 +27,7 @@ import org.eclipse.jetty.http2.generator.SettingsGenerator; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -35,7 +35,7 @@ public class SettingsGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParseNoSettings() @@ -85,7 +85,7 @@ public void onSettings(SettingsFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateSettings(accumulator, settings, true); frames.clear(); @@ -119,7 +119,7 @@ public void onConnectionFailure(int error, String reason) Map settings1 = new HashMap<>(); settings1.put(13, 17); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateSettings(accumulator, settings1, true); // Modify the length of the frame to make it invalid ByteBuffer bytes = accumulator.getByteBuffers().get(0); @@ -160,7 +160,7 @@ public void onSettings(SettingsFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateSettings(accumulator, settings1, true); frames.clear(); @@ -205,7 +205,7 @@ public void onConnectionFailure(int error, String reason) settings.put(i + 10, i); } - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateSettings(accumulator, settings, false); for (ByteBuffer buffer : accumulator.getByteBuffers()) @@ -283,7 +283,7 @@ public void onConnectionFailure(int error, String reason) Map settings = new HashMap<>(); settings.put(13, 17); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); for (int i = 0; i < maxSettingsKeys + 1; ++i) { generator.generateSettings(accumulator, settings, false); diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/UnknownParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/UnknownParseTest.java index 83cc84502054..b94e4821434f 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/UnknownParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/UnknownParseTest.java @@ -22,7 +22,7 @@ import org.eclipse.jetty.http2.ErrorCode; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -30,7 +30,7 @@ public class UnknownParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testParse() diff --git a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/WindowUpdateGenerateParseTest.java b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/WindowUpdateGenerateParseTest.java index 6f75f3cd467e..369b9e03582e 100644 --- a/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/WindowUpdateGenerateParseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-common/src/test/java/org/eclipse/jetty/http2/frames/WindowUpdateGenerateParseTest.java @@ -22,14 +22,14 @@ import org.eclipse.jetty.http2.generator.WindowUpdateGenerator; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class WindowUpdateGenerateParseTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testGenerateParse() throws Exception @@ -53,7 +53,7 @@ public void onWindowUpdate(WindowUpdateFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateWindowUpdate(accumulator, streamId, windowUpdate); frames.clear(); @@ -94,7 +94,7 @@ public void onWindowUpdate(WindowUpdateFrame frame) // Iterate a few times to be sure generator and parser are properly reset. for (int i = 0; i < 2; ++i) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.generateWindowUpdate(accumulator, streamId, windowUpdate); frames.clear(); diff --git a/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java b/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java index b6e8a72b3acf..b3a2bcfcc23f 100644 --- a/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java +++ b/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java @@ -37,9 +37,9 @@ import org.eclipse.jetty.http2.parser.ServerParser; import org.eclipse.jetty.http2.server.internal.HTTP2ServerConnection; import org.eclipse.jetty.http2.server.internal.HTTP2ServerSession; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.AbstractConnectionFactory; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; @@ -271,7 +271,7 @@ public Connection newConnection(Connector connector, EndPoint endPoint) { ServerSessionListener listener = newSessionListener(connector, endPoint); - Generator generator = new Generator(connector.getRetainableByteBufferPool(), isUseOutputDirectByteBuffers(), getMaxDynamicTableSize(), getMaxHeaderBlockFragment()); + Generator generator = new Generator(connector.getByteBufferPool(), isUseOutputDirectByteBuffers(), getMaxDynamicTableSize(), getMaxHeaderBlockFragment()); FlowControlStrategy flowControl = getFlowControlStrategyFactory().newFlowControlStrategy(); HTTP2ServerSession session = new HTTP2ServerSession(connector.getScheduler(), endPoint, generator, listener, flowControl); session.setMaxLocalStreams(getMaxConcurrentStreams()); @@ -291,9 +291,9 @@ public Connection newConnection(Connector connector, EndPoint endPoint) parser.setMaxFrameLength(getMaxFrameLength()); parser.setMaxSettingsKeys(getMaxSettingsKeys()); - RetainableByteBufferPool retainableByteBufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool byteBufferPool = connector.getByteBufferPool(); - HTTP2Connection connection = new HTTP2ServerConnection(retainableByteBufferPool, connector, + HTTP2Connection connection = new HTTP2ServerConnection(byteBufferPool, connector, endPoint, httpConfiguration, parser, session, getInputBufferSize(), listener); connection.setUseInputDirectByteBuffers(isUseInputDirectByteBuffers()); connection.setUseOutputDirectByteBuffers(isUseOutputDirectByteBuffers()); @@ -305,7 +305,7 @@ public Connection newConnection(Connector connector, EndPoint endPoint) private ServerParser newServerParser(Connector connector, ServerParser.Listener listener, RateControl rateControl) { - return new ServerParser(connector.getRetainableByteBufferPool(), listener, getMaxDynamicTableSize(), getHttpConfiguration().getRequestHeaderSize(), rateControl); + return new ServerParser(connector.getByteBufferPool(), listener, getMaxDynamicTableSize(), getHttpConfiguration().getRequestHeaderSize(), rateControl); } @ManagedObject("The container of HTTP/2 sessions") diff --git a/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/internal/HTTP2ServerConnection.java b/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/internal/HTTP2ServerConnection.java index 8132aa9f47a9..1e22dd62bcf6 100644 --- a/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/internal/HTTP2ServerConnection.java +++ b/jetty-core/jetty-http2/jetty-http2-server/src/main/java/org/eclipse/jetty/http2/server/internal/HTTP2ServerConnection.java @@ -40,9 +40,9 @@ import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.parser.ServerParser; import org.eclipse.jetty.http2.parser.SettingsBodyParser; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Connector; @@ -69,9 +69,9 @@ public class HTTP2ServerConnection extends HTTP2Connection implements Connection private final HttpConfiguration httpConfig; private final String id; - public HTTP2ServerConnection(RetainableByteBufferPool retainableByteBufferPool, Connector connector, EndPoint endPoint, HttpConfiguration httpConfig, ServerParser parser, HTTP2Session session, int inputBufferSize, ServerSessionListener listener) + public HTTP2ServerConnection(ByteBufferPool byteBufferPool, Connector connector, EndPoint endPoint, HttpConfiguration httpConfig, ServerParser parser, HTTP2Session session, int inputBufferSize, ServerSessionListener listener) { - super(retainableByteBufferPool, connector.getExecutor(), endPoint, parser, session, inputBufferSize); + super(byteBufferPool, connector.getExecutor(), endPoint, parser, session, inputBufferSize); this.connector = connector; this.listener = listener; this.httpConfig = httpConfig; diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/AbstractServerTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/AbstractServerTest.java index 39f6d51e9dde..9c88fceb424e 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/AbstractServerTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/AbstractServerTest.java @@ -30,7 +30,7 @@ import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; import org.eclipse.jetty.http2.server.RawHTTP2ServerConnectionFactory; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; @@ -42,7 +42,7 @@ public class AbstractServerTest { protected ServerConnector connector; - protected RetainableByteBufferPool bufferPool; + protected ByteBufferPool bufferPool; protected Generator generator; protected Server server; protected String path; diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/BadURITest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/BadURITest.java index 6702aa7cd983..97aa202bdfb3 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/BadURITest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/BadURITest.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.generator.Generator; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.Request; @@ -97,7 +97,7 @@ public ByteBuffer badMessageError(int status, String reason, HttpFields.Mutable } }); - RetainableByteBufferPool bufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connector.getByteBufferPool(); Generator generator = new Generator(bufferPool); // Craft a request with a bad URI, it will not hit the Handler. @@ -111,7 +111,7 @@ public ByteBuffer badMessageError(int status, String reason, HttpFields.Mutable HttpFields.EMPTY, -1 ); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); generator.control(accumulator, new HeadersFrame(1, metaData1, null, true)); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/CloseTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/CloseTest.java index c6c57a387026..a1265cdc5de6 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/CloseTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/CloseTest.java @@ -37,7 +37,7 @@ import org.eclipse.jetty.http2.frames.PrefaceFrame; import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.parser.Parser; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; @@ -74,7 +74,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -135,7 +135,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -202,7 +202,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) }); connector.setIdleTimeout(idleTimeout); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/DataDemandTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/DataDemandTest.java index f2259b072a65..266a6a55c6fa 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/DataDemandTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/DataDemandTest.java @@ -36,7 +36,7 @@ import org.eclipse.jetty.http2.frames.HeadersFrame; import org.eclipse.jetty.http2.generator.Generator; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FuturePromise; import org.eclipse.jetty.util.Promise; @@ -365,9 +365,9 @@ public void onHeaders(Stream stream, HeadersFrame frame) // Generate a lot of small DATA frames and write them in a single // write so that the server will continuously be notified and demand, // which will test that it won't throw StackOverflowError. - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); Generator generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); for (int i = 512; i >= 0; --i) generator.data(accumulator, new DataFrame(clientStream.getId(), ByteBuffer.allocate(1), i == 0), 1); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/FlowControlStrategyTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/FlowControlStrategyTest.java index b1c01fa30985..ce4237cc8f0c 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/FlowControlStrategyTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/FlowControlStrategyTest.java @@ -51,7 +51,7 @@ import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.frames.WindowUpdateFrame; import org.eclipse.jetty.http2.server.RawHTTP2ServerConnectionFactory; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -844,7 +844,7 @@ public void succeeded() // Now the client is supposed to not send more frames. // If it does, the connection must be closed. HTTP2Session http2Session = (HTTP2Session)session; - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); ByteBuffer extraData = ByteBuffer.allocate(1024); http2Session.getGenerator().data(accumulator, new DataFrame(stream.getId(), extraData, true), extraData.remaining()); List buffers = accumulator.getByteBuffers(); @@ -949,7 +949,7 @@ public void succeeded() // Now the client is supposed to not send more frames. // If it does, the connection must be closed. HTTP2Session http2Session = (HTTP2Session)session; - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); ByteBuffer extraData = ByteBuffer.allocate(1024); http2Session.getGenerator().data(accumulator, new DataFrame(stream.getId(), extraData, true), extraData.remaining()); List buffers = accumulator.getByteBuffers(); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2CServerTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2CServerTest.java index 581d13e1379f..2231af504b54 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2CServerTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2CServerTest.java @@ -39,9 +39,9 @@ import org.eclipse.jetty.http2.generator.Generator; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.ServerConnector; @@ -196,7 +196,7 @@ public void onData(DataFrame frame) headersRef.set(null); dataRef.set(null); latchRef.set(new CountDownLatch(2)); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = new MetaData.Request("GET", HttpScheme.HTTP.asString(), new HostPortHttpField("localhost:" + connector.getLocalPort()), "/two", HttpVersion.HTTP_2, HttpFields.EMPTY, -1); @@ -234,7 +234,7 @@ public void testHTTP20Direct() throws Exception bufferPool = new ArrayRetainableByteBufferPool(); generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = new MetaData.Request("GET", HttpScheme.HTTP.asString(), new HostPortHttpField("localhost:" + connector.getLocalPort()), "/test", HttpVersion.HTTP_2, HttpFields.EMPTY, -1); @@ -331,7 +331,7 @@ public void onFillable() bufferPool = new ArrayRetainableByteBufferPool(); generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); try (Socket client = new Socket("localhost", connector.getLocalPort())) diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2ServerTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2ServerTest.java index cfda77eb9065..e5b3feea8efb 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2ServerTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2ServerTest.java @@ -47,9 +47,9 @@ import org.eclipse.jetty.http2.internal.Flags; import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ManagedSelector; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SocketChannelEndPoint; import org.eclipse.jetty.logging.StacklessLogging; import org.eclipse.jetty.server.Handler; @@ -85,7 +85,7 @@ public boolean process(Request request, Response response, Callback callback) // No preface bytes. MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new HeadersFrame(1, metaData, null, true)); try (Socket client = new Socket("localhost", connector.getLocalPort())) @@ -128,7 +128,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -187,7 +187,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -255,7 +255,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); generator.control(accumulator, new PingFrame(new byte[8], false)); @@ -301,7 +301,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); generator.control(accumulator, new PingFrame(new byte[8], false)); @@ -374,7 +374,7 @@ public void write(Callback callback, ByteBuffer... buffers) throws IllegalStateE server.addConnector(connector2); server.start(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -414,7 +414,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -443,7 +443,7 @@ public void testRequestWithContinuationFrames() throws Exception { testRequestWithContinuationFrames(null, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -458,7 +458,7 @@ public void testRequestWithPriorityWithContinuationFrames() throws Exception PriorityFrame priority = new PriorityFrame(1, 13, 200, true); testRequestWithContinuationFrames(priority, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -472,7 +472,7 @@ public void testRequestWithContinuationFramesWithEmptyHeadersFrame() throws Exce { testRequestWithContinuationFrames(null, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -494,7 +494,7 @@ public void testRequestWithPriorityWithContinuationFramesWithEmptyHeadersFrame() PriorityFrame priority = new PriorityFrame(1, 13, 200, true); testRequestWithContinuationFrames(null, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -515,7 +515,7 @@ public void testRequestWithContinuationFramesWithEmptyContinuationFrame() throws { testRequestWithContinuationFrames(null, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -539,7 +539,7 @@ public void testRequestWithContinuationFramesWithEmptyLastContinuationFrame() th { testRequestWithContinuationFrames(null, () -> { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); generator.control(accumulator, new SettingsFrame(new HashMap<>(), false)); MetaData.Request metaData = newRequest("GET", HttpFields.EMPTY); @@ -560,7 +560,7 @@ public void testRequestWithContinuationFramesWithEmptyLastContinuationFrame() th }); } - private void testRequestWithContinuationFrames(PriorityFrame priorityFrame, Callable frames) throws Exception + private void testRequestWithContinuationFrames(PriorityFrame priorityFrame, Callable frames) throws Exception { CountDownLatch serverLatch = new CountDownLatch(1); startServer(new ServerSessionListener() @@ -588,7 +588,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) }); generator = new Generator(bufferPool, 4096, 4); - RetainableByteBufferPool.Accumulator accumulator = frames.call(); + ByteBufferPool.Accumulator accumulator = frames.call(); try (Socket client = new Socket("localhost", connector.getLocalPort())) { diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HttpClientTransportOverHTTP2Test.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HttpClientTransportOverHTTP2Test.java index 6c58c955e5f6..7b74885fd87a 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HttpClientTransportOverHTTP2Test.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HttpClientTransportOverHTTP2Test.java @@ -68,9 +68,9 @@ import org.eclipse.jetty.http2.parser.ServerParser; import org.eclipse.jetty.http2.server.RawHTTP2ServerConnectionFactory; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Content; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.Request; @@ -111,7 +111,7 @@ public void testPropertiesAreForwarded() throws Exception assertTrue(http2Client.isStarted()); assertSame(httpClient.getExecutor(), http2Client.getExecutor()); assertSame(httpClient.getScheduler(), http2Client.getScheduler()); - assertSame(httpClient.getRetainableByteBufferPool(), http2Client.getRetainableByteBufferPool()); + assertSame(httpClient.getByteBufferPool(), http2Client.getByteBufferPool()); assertEquals(httpClient.getConnectTimeout(), http2Client.getConnectTimeout()); assertEquals(httpClient.getIdleTimeout(), http2Client.getIdleTimeout()); assertEquals(httpClient.isUseInputDirectByteBuffers(), http2Client.isUseInputDirectByteBuffers()); @@ -541,8 +541,8 @@ protected Connection newConnection(Destination destination, Session session) resultLatch.countDown(); }); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); Generator generator = new Generator(bufferPool); try (Socket socket = server.accept()) diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/PrefaceTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/PrefaceTest.java index 5055cefc8eae..dbdd3c54b25b 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/PrefaceTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/PrefaceTest.java @@ -51,8 +51,8 @@ import org.eclipse.jetty.http2.parser.Parser; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -148,13 +148,13 @@ public void onPing(Session session, PingFrame frame) } }); - RetainableByteBufferPool bufferPool = http2Client.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = http2Client.getByteBufferPool(); try (SocketChannel socket = SocketChannel.open()) { socket.connect(new InetSocketAddress("localhost", connector.getLocalPort())); Generator generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); Map clientSettings = new HashMap<>(); clientSettings.put(SettingsFrame.ENABLE_PUSH, 0); @@ -247,7 +247,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) }); server.start(); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); try (SocketChannel socket = SocketChannel.open()) { socket.connect(new InetSocketAddress("localhost", connector.getLocalPort())); @@ -296,7 +296,7 @@ public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) // After the 101, the client must send the connection preface. Generator generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); Map clientSettings = new HashMap<>(); clientSettings.put(SettingsFrame.ENABLE_PUSH, 1); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamCountTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamCountTest.java index b83245ae0ad9..9eb667f06d73 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamCountTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamCountTest.java @@ -33,7 +33,7 @@ import org.eclipse.jetty.http2.frames.ResetFrame; import org.eclipse.jetty.http2.frames.SettingsFrame; import org.eclipse.jetty.http2.generator.Generator; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FuturePromise; @@ -201,7 +201,7 @@ public void onReset(Stream stream, ResetFrame frame, Callback callback) HeadersFrame frame3 = new HeadersFrame(streamId3, metaData, null, false); DataFrame data3 = new DataFrame(streamId3, BufferUtil.EMPTY_BUFFER, true); Generator generator = ((HTTP2Session)session).getGenerator(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, frame3); generator.data(accumulator, data3, data3.remaining()); ((HTTP2Session)session).getEndPoint().write(Callback.NOOP, accumulator.getByteBuffers().toArray(ByteBuffer[]::new)); diff --git a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamResetTest.java b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamResetTest.java index 7db1178f8af3..3b1dffbcd045 100644 --- a/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamResetTest.java +++ b/jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/StreamResetTest.java @@ -64,8 +64,8 @@ import org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory; import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; import org.eclipse.jetty.io.AbstractEndPoint; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.WriteFlusher; import org.eclipse.jetty.logging.StacklessLogging; import org.eclipse.jetty.server.Handler; @@ -887,7 +887,7 @@ public boolean process(Request request, Response response, Callback callback) } }); - RetainableByteBufferPool bufferPool = http2Client.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = http2Client.getByteBufferPool(); try (SocketChannel socket = SocketChannel.open()) { String host = "localhost"; @@ -895,7 +895,7 @@ public boolean process(Request request, Response response, Callback callback) socket.connect(new InetSocketAddress(host, port)); Generator generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); Map clientSettings = new HashMap<>(); // Max stream HTTP/2 flow control window. @@ -978,7 +978,7 @@ private void service2(Response response, Callback callback) throws Exception } }); - RetainableByteBufferPool bufferPool = http2Client.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = http2Client.getByteBufferPool(); try (SocketChannel socket = SocketChannel.open()) { String host = "localhost"; @@ -986,7 +986,7 @@ private void service2(Response response, Callback callback) throws Exception socket.connect(new InetSocketAddress(host, port)); Generator generator = new Generator(bufferPool); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); generator.control(accumulator, new PrefaceFrame()); Map clientSettings = new HashMap<>(); // Max stream HTTP/2 flow control window. diff --git a/jetty-core/jetty-http3/jetty-http3-client-transport/src/main/java/org/eclipse/jetty/http3/client/transport/HttpClientTransportOverHTTP3.java b/jetty-core/jetty-http3/jetty-http3-client-transport/src/main/java/org/eclipse/jetty/http3/client/transport/HttpClientTransportOverHTTP3.java index b9586f049ebf..36301a9a6b80 100644 --- a/jetty-core/jetty-http3/jetty-http3-client-transport/src/main/java/org/eclipse/jetty/http3/client/transport/HttpClientTransportOverHTTP3.java +++ b/jetty-core/jetty-http3/jetty-http3-client-transport/src/main/java/org/eclipse/jetty/http3/client/transport/HttpClientTransportOverHTTP3.java @@ -69,7 +69,7 @@ protected void doStart() throws Exception ClientConnector clientConnector = this.client.getClientConnector(); clientConnector.setExecutor(httpClient.getExecutor()); clientConnector.setScheduler(httpClient.getScheduler()); - clientConnector.setRetainableByteBufferPool(httpClient.getRetainableByteBufferPool()); + clientConnector.setByteBufferPool(httpClient.getByteBufferPool()); clientConnector.setConnectTimeout(Duration.ofMillis(httpClient.getConnectTimeout())); clientConnector.setConnectBlocking(httpClient.isConnectBlocking()); clientConnector.setBindAddress(httpClient.getBindAddress()); diff --git a/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientHTTP3Session.java b/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientHTTP3Session.java index 382afa5286b8..dcf4cbabbda9 100644 --- a/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientHTTP3Session.java +++ b/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientHTTP3Session.java @@ -30,7 +30,7 @@ import org.eclipse.jetty.http3.frames.SettingsFrame; import org.eclipse.jetty.http3.qpack.QpackDecoder; import org.eclipse.jetty.http3.qpack.QpackEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.quic.client.ClientProtocolSession; import org.eclipse.jetty.quic.client.ClientQuicSession; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; @@ -64,7 +64,7 @@ public ClientHTTP3Session(HTTP3Configuration configuration, ClientQuicSession qu long encoderStreamId = getQuicSession().newStreamId(StreamType.CLIENT_UNIDIRECTIONAL); QuicStreamEndPoint encoderEndPoint = openInstructionEndPoint(encoderStreamId); InstructionFlusher encoderInstructionFlusher = new InstructionFlusher(quicSession, encoderEndPoint, EncoderStreamConnection.STREAM_TYPE); - RetainableByteBufferPool bufferPool = quicSession.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = quicSession.getByteBufferPool(); this.encoder = new QpackEncoder(bufferPool, new InstructionHandler(encoderInstructionFlusher), configuration.getMaxBlockedStreams()); addBean(encoder); if (LOG.isDebugEnabled()) @@ -85,7 +85,7 @@ public ClientHTTP3Session(HTTP3Configuration configuration, ClientQuicSession qu if (LOG.isDebugEnabled()) LOG.debug("created control stream #{} on {}", controlStreamId, controlEndPoint); - this.messageFlusher = new MessageFlusher(quicSession.getRetainableByteBufferPool(), encoder, configuration.getMaxRequestHeadersSize(), configuration.isUseOutputDirectByteBuffers()); + this.messageFlusher = new MessageFlusher(quicSession.getByteBufferPool(), encoder, configuration.getMaxRequestHeadersSize(), configuration.isUseOutputDirectByteBuffers()); addBean(messageFlusher); } @@ -199,7 +199,7 @@ protected void onClose(long error, String reason) private void openUnidirectionalStreamEndPoint(QuicStreamEndPoint endPoint) { - UnidirectionalStreamConnection connection = new UnidirectionalStreamConnection(endPoint, getQuicSession().getExecutor(), getQuicSession().getRetainableByteBufferPool(), encoder, decoder, session); + UnidirectionalStreamConnection connection = new UnidirectionalStreamConnection(endPoint, getQuicSession().getExecutor(), getQuicSession().getByteBufferPool(), encoder, decoder, session); endPoint.setConnection(connection); endPoint.opened(); } diff --git a/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/internal/ClientHTTP3StreamConnection.java b/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/internal/ClientHTTP3StreamConnection.java index 709a18f034f7..bd51ba5abc89 100644 --- a/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/internal/ClientHTTP3StreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/internal/ClientHTTP3StreamConnection.java @@ -22,6 +22,6 @@ public class ClientHTTP3StreamConnection extends HTTP3StreamConnection { public ClientHTTP3StreamConnection(QuicStreamEndPoint endPoint, ClientHTTP3Session session, MessageParser parser) { - super(endPoint, session.getQuicSession().getExecutor(), session.getQuicSession().getRetainableByteBufferPool(), parser); + super(endPoint, session.getQuicSession().getExecutor(), session.getQuicSession().getByteBufferPool(), parser); } } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/ControlFlusher.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/ControlFlusher.java index 793d0b861bdd..2ce9fac5388b 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/ControlFlusher.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/ControlFlusher.java @@ -23,8 +23,8 @@ import org.eclipse.jetty.http3.generator.ControlGenerator; import org.eclipse.jetty.http3.internal.ControlStreamConnection; import org.eclipse.jetty.http3.internal.VarLenInt; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.QuicSession; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.eclipse.jetty.util.Callback; @@ -42,7 +42,7 @@ public class ControlFlusher extends IteratingCallback private final Queue queue = new ArrayDeque<>(); private final QuicStreamEndPoint endPoint; private final ControlGenerator generator; - private final RetainableByteBufferPool.Accumulator accumulator; + private final ByteBufferPool.Accumulator accumulator; private boolean initialized; private Throwable terminated; private List entries; @@ -51,9 +51,9 @@ public class ControlFlusher extends IteratingCallback public ControlFlusher(QuicSession session, QuicStreamEndPoint endPoint, boolean useDirectByteBuffers) { this.endPoint = endPoint; - RetainableByteBufferPool bufferPool = session.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = session.getByteBufferPool(); this.generator = new ControlGenerator(bufferPool, useDirectByteBuffers); - this.accumulator = new RetainableByteBufferPool.Accumulator(); + this.accumulator = new ByteBufferPool.Accumulator(); } public boolean offer(Frame frame, Callback callback) diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/DecoderStreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/DecoderStreamConnection.java index 81085a09de71..e2241cd339de 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/DecoderStreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/DecoderStreamConnection.java @@ -18,8 +18,8 @@ import org.eclipse.jetty.http3.qpack.QpackEncoder; import org.eclipse.jetty.http3.qpack.QpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; public class DecoderStreamConnection extends InstructionStreamConnection { @@ -28,7 +28,7 @@ public class DecoderStreamConnection extends InstructionStreamConnection private final QpackEncoder encoder; - public DecoderStreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, QpackEncoder encoder) + public DecoderStreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, QpackEncoder encoder) { super(endPoint, executor, bufferPool); this.encoder = encoder; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/EncoderStreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/EncoderStreamConnection.java index 990c8cab352a..3c87986972da 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/EncoderStreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/EncoderStreamConnection.java @@ -18,8 +18,8 @@ import org.eclipse.jetty.http3.qpack.QpackDecoder; import org.eclipse.jetty.http3.qpack.QpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; public class EncoderStreamConnection extends InstructionStreamConnection { @@ -28,7 +28,7 @@ public class EncoderStreamConnection extends InstructionStreamConnection private final QpackDecoder decoder; - public EncoderStreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, QpackDecoder decoder) + public EncoderStreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, QpackDecoder decoder) { super(endPoint, executor, bufferPool); this.decoder = decoder; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/HTTP3StreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/HTTP3StreamConnection.java index 81ab895bc791..39e9581a3a8d 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/HTTP3StreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/HTTP3StreamConnection.java @@ -27,8 +27,8 @@ import org.eclipse.jetty.http3.parser.MessageParser; import org.eclipse.jetty.http3.parser.ParserListener; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +40,7 @@ public abstract class HTTP3StreamConnection extends AbstractConnection private static final ByteBuffer EMPTY_DATA_FRAME = ByteBuffer.allocate(2); private final AtomicReference action = new AtomicReference<>(); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final MessageParser parser; private boolean useInputDirectByteBuffers = true; private HTTP3Stream stream; @@ -48,7 +48,7 @@ public abstract class HTTP3StreamConnection extends AbstractConnection private boolean applicationMode; private boolean remotelyClosed; - public HTTP3StreamConnection(QuicStreamEndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, MessageParser parser) + public HTTP3StreamConnection(QuicStreamEndPoint endPoint, Executor executor, ByteBufferPool bufferPool, MessageParser parser) { super(endPoint, executor); this.bufferPool = bufferPool; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionFlusher.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionFlusher.java index 7585471aa539..3e79d130957b 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionFlusher.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionFlusher.java @@ -21,8 +21,8 @@ import org.eclipse.jetty.http3.internal.VarLenInt; import org.eclipse.jetty.http3.qpack.Instruction; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.QuicSession; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.eclipse.jetty.util.BufferUtil; @@ -41,8 +41,8 @@ public class InstructionFlusher extends IteratingCallback private final AutoLock lock = new AutoLock(); private final Queue queue = new ArrayDeque<>(); - private final RetainableByteBufferPool bufferPool; - private final RetainableByteBufferPool.Accumulator accumulator; + private final ByteBufferPool bufferPool; + private final ByteBufferPool.Accumulator accumulator; private final QuicStreamEndPoint endPoint; private final long streamType; private boolean initialized; @@ -50,8 +50,8 @@ public class InstructionFlusher extends IteratingCallback public InstructionFlusher(QuicSession session, QuicStreamEndPoint endPoint, long streamType) { - this.bufferPool = session.getRetainableByteBufferPool(); - this.accumulator = new RetainableByteBufferPool.Accumulator(); + this.bufferPool = session.getByteBufferPool(); + this.accumulator = new ByteBufferPool.Accumulator(); this.endPoint = endPoint; this.streamType = streamType; } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionStreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionStreamConnection.java index 2af6820f8cbb..a8af09ebe1c6 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionStreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/InstructionStreamConnection.java @@ -18,10 +18,10 @@ import org.eclipse.jetty.http3.qpack.QpackException; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,11 +29,11 @@ public abstract class InstructionStreamConnection extends AbstractConnection implements Connection.UpgradeTo { private static final Logger LOG = LoggerFactory.getLogger(InstructionStreamConnection.class); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private boolean useInputDirectByteBuffers = true; private RetainableByteBuffer buffer; - public InstructionStreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool) + public InstructionStreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool) { super(endPoint, executor); this.bufferPool = bufferPool; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/MessageFlusher.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/MessageFlusher.java index 3e75135088a0..955b424be569 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/MessageFlusher.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/MessageFlusher.java @@ -21,7 +21,7 @@ import org.eclipse.jetty.http3.frames.Frame; import org.eclipse.jetty.http3.generator.MessageGenerator; import org.eclipse.jetty.http3.qpack.QpackEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingCallback; @@ -35,13 +35,13 @@ public class MessageFlusher extends IteratingCallback private final AutoLock lock = new AutoLock(); private final Queue entries = new ArrayDeque<>(); - private final RetainableByteBufferPool.Accumulator accumulator; + private final ByteBufferPool.Accumulator accumulator; private final MessageGenerator generator; private Entry entry; - public MessageFlusher(RetainableByteBufferPool bufferPool, QpackEncoder encoder, int maxHeadersLength, boolean useDirectByteBuffers) + public MessageFlusher(ByteBufferPool bufferPool, QpackEncoder encoder, int maxHeadersLength, boolean useDirectByteBuffers) { - this.accumulator = new RetainableByteBufferPool.Accumulator(); + this.accumulator = new ByteBufferPool.Accumulator(); this.generator = new MessageGenerator(bufferPool, encoder, maxHeadersLength, useDirectByteBuffers); } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/UnidirectionalStreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/UnidirectionalStreamConnection.java index bc4451a4176c..32e548f2dc67 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/UnidirectionalStreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/UnidirectionalStreamConnection.java @@ -23,9 +23,9 @@ import org.eclipse.jetty.http3.qpack.QpackDecoder; import org.eclipse.jetty.http3.qpack.QpackEncoder; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.eclipse.jetty.quic.common.StreamType; import org.slf4j.Logger; @@ -35,7 +35,7 @@ public class UnidirectionalStreamConnection extends AbstractConnection implement { private static final Logger LOG = LoggerFactory.getLogger(UnidirectionalStreamConnection.class); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final QpackEncoder encoder; private final QpackDecoder decoder; private final ParserListener listener; @@ -43,7 +43,7 @@ public class UnidirectionalStreamConnection extends AbstractConnection implement private boolean useInputDirectByteBuffers = true; private RetainableByteBuffer buffer; - public UnidirectionalStreamConnection(QuicStreamEndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, QpackEncoder encoder, QpackDecoder decoder, ParserListener listener) + public UnidirectionalStreamConnection(QuicStreamEndPoint endPoint, Executor executor, ByteBufferPool bufferPool, QpackEncoder encoder, QpackDecoder decoder, ParserListener listener) { super(endPoint, executor); this.bufferPool = bufferPool; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/CancelPushGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/CancelPushGenerator.java index 55237a1fbcee..d23f2732ab73 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/CancelPushGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/CancelPushGenerator.java @@ -16,17 +16,17 @@ import java.util.function.Consumer; import org.eclipse.jetty.http3.frames.Frame; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class CancelPushGenerator extends FrameGenerator { - public CancelPushGenerator(RetainableByteBufferPool bufferPool) + public CancelPushGenerator(ByteBufferPool bufferPool) { super(bufferPool); } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { return 0; } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/ControlGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/ControlGenerator.java index ec9abad6b269..3a0dc0be385a 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/ControlGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/ControlGenerator.java @@ -17,13 +17,13 @@ import org.eclipse.jetty.http3.frames.Frame; import org.eclipse.jetty.http3.frames.FrameType; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class ControlGenerator { private final FrameGenerator[] generators = new FrameGenerator[FrameType.maxType() + 1]; - public ControlGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public ControlGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { generators[FrameType.CANCEL_PUSH.type()] = new CancelPushGenerator(bufferPool); generators[FrameType.SETTINGS.type()] = new SettingsGenerator(bufferPool, useDirectByteBuffers); @@ -31,7 +31,7 @@ public ControlGenerator(RetainableByteBufferPool bufferPool, boolean useDirectBy generators[FrameType.MAX_PUSH_ID.type()] = new MaxPushIdGenerator(bufferPool); } - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { return generators[frame.getFrameType().type()].generate(accumulator, streamId, frame, fail); } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/DataGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/DataGenerator.java index 05a808f353a3..48ba615be268 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/DataGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/DataGenerator.java @@ -20,33 +20,33 @@ import org.eclipse.jetty.http3.frames.Frame; import org.eclipse.jetty.http3.frames.FrameType; import org.eclipse.jetty.http3.internal.VarLenInt; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class DataGenerator extends FrameGenerator { private final boolean useDirectByteBuffers; - public DataGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public DataGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { super(bufferPool); this.useDirectByteBuffers = useDirectByteBuffers; } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { DataFrame dataFrame = (DataFrame)frame; return generateDataFrame(accumulator, dataFrame); } - private int generateDataFrame(RetainableByteBufferPool.Accumulator accumulator, DataFrame frame) + private int generateDataFrame(ByteBufferPool.Accumulator accumulator, DataFrame frame) { ByteBuffer data = frame.getByteBuffer(); int dataLength = data.remaining(); int headerLength = VarLenInt.length(FrameType.DATA.type()) + VarLenInt.length(dataLength); - RetainableByteBuffer header = getRetainableByteBufferPool().acquire(headerLength, useDirectByteBuffers); + RetainableByteBuffer header = getByteBufferPool().acquire(headerLength, useDirectByteBuffers); ByteBuffer byteBuffer = header.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); VarLenInt.encode(byteBuffer, FrameType.DATA.type()); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/FrameGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/FrameGenerator.java index 9154b60bf540..81413153cd59 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/FrameGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/FrameGenerator.java @@ -16,21 +16,21 @@ import java.util.function.Consumer; import org.eclipse.jetty.http3.frames.Frame; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public abstract class FrameGenerator { - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; - public FrameGenerator(RetainableByteBufferPool bufferPool) + public FrameGenerator(ByteBufferPool bufferPool) { this.bufferPool = bufferPool; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } - public abstract int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail); + public abstract int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail); } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/GoAwayGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/GoAwayGenerator.java index 90c1ba551dff..7c4b3b123c77 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/GoAwayGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/GoAwayGenerator.java @@ -20,33 +20,33 @@ import org.eclipse.jetty.http3.frames.FrameType; import org.eclipse.jetty.http3.frames.GoAwayFrame; import org.eclipse.jetty.http3.internal.VarLenInt; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class GoAwayGenerator extends FrameGenerator { private final boolean useDirectByteBuffers; - public GoAwayGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public GoAwayGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { super(bufferPool); this.useDirectByteBuffers = useDirectByteBuffers; } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { GoAwayFrame goAwayFrame = (GoAwayFrame)frame; return generateGoAwayFrame(accumulator, goAwayFrame); } - private int generateGoAwayFrame(RetainableByteBufferPool.Accumulator accumulator, GoAwayFrame frame) + private int generateGoAwayFrame(ByteBufferPool.Accumulator accumulator, GoAwayFrame frame) { long lastId = frame.getLastId(); int lastIdLength = VarLenInt.length(lastId); int length = VarLenInt.length(FrameType.GOAWAY.type()) + VarLenInt.length(lastIdLength) + lastIdLength; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(length, useDirectByteBuffers); + RetainableByteBuffer buffer = getByteBufferPool().acquire(length, useDirectByteBuffers); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); VarLenInt.encode(byteBuffer, FrameType.GOAWAY.type()); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/HeadersGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/HeadersGenerator.java index 3b6a4436fefa..25e76885365f 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/HeadersGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/HeadersGenerator.java @@ -22,8 +22,8 @@ import org.eclipse.jetty.http3.internal.VarLenInt; import org.eclipse.jetty.http3.qpack.QpackEncoder; import org.eclipse.jetty.http3.qpack.QpackException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class HeadersGenerator extends FrameGenerator @@ -32,7 +32,7 @@ public class HeadersGenerator extends FrameGenerator private final int maxLength; private final boolean useDirectByteBuffers; - public HeadersGenerator(RetainableByteBufferPool bufferPool, QpackEncoder encoder, int maxLength, boolean useDirectByteBuffers) + public HeadersGenerator(ByteBufferPool bufferPool, QpackEncoder encoder, int maxLength, boolean useDirectByteBuffers) { super(bufferPool); this.encoder = encoder; @@ -41,13 +41,13 @@ public HeadersGenerator(RetainableByteBufferPool bufferPool, QpackEncoder encode } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { HeadersFrame headersFrame = (HeadersFrame)frame; return generateHeadersFrame(accumulator, streamId, headersFrame, fail); } - private int generateHeadersFrame(RetainableByteBufferPool.Accumulator accumulator, long streamId, HeadersFrame frame, Consumer fail) + private int generateHeadersFrame(ByteBufferPool.Accumulator accumulator, long streamId, HeadersFrame frame, Consumer fail) { try { @@ -55,7 +55,7 @@ private int generateHeadersFrame(RetainableByteBufferPool.Accumulator accumulato int frameTypeLength = VarLenInt.length(FrameType.HEADERS.type()); int maxHeaderLength = frameTypeLength + VarLenInt.MAX_LENGTH; // The capacity of the buffer is larger than maxLength, but we need to enforce at most maxLength. - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(maxHeaderLength + maxLength, useDirectByteBuffers); + RetainableByteBuffer buffer = getByteBufferPool().acquire(maxHeaderLength + maxLength, useDirectByteBuffers); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.position(maxHeaderLength); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MaxPushIdGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MaxPushIdGenerator.java index bf2cc54d055c..8ce7f81e1220 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MaxPushIdGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MaxPushIdGenerator.java @@ -16,17 +16,17 @@ import java.util.function.Consumer; import org.eclipse.jetty.http3.frames.Frame; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class MaxPushIdGenerator extends FrameGenerator { - public MaxPushIdGenerator(RetainableByteBufferPool bufferPool) + public MaxPushIdGenerator(ByteBufferPool bufferPool) { super(bufferPool); } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { return 0; } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MessageGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MessageGenerator.java index a5f5744907f5..182fa1c4a7d8 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MessageGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/MessageGenerator.java @@ -18,20 +18,20 @@ import org.eclipse.jetty.http3.frames.Frame; import org.eclipse.jetty.http3.frames.FrameType; import org.eclipse.jetty.http3.qpack.QpackEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class MessageGenerator { private final FrameGenerator[] generators = new FrameGenerator[FrameType.maxType() + 1]; - public MessageGenerator(RetainableByteBufferPool bufferPool, QpackEncoder encoder, int maxHeadersLength, boolean useDirectByteBuffers) + public MessageGenerator(ByteBufferPool bufferPool, QpackEncoder encoder, int maxHeadersLength, boolean useDirectByteBuffers) { generators[FrameType.DATA.type()] = new DataGenerator(bufferPool, useDirectByteBuffers); generators[FrameType.HEADERS.type()] = new HeadersGenerator(bufferPool, encoder, maxHeadersLength, useDirectByteBuffers); generators[FrameType.PUSH_PROMISE.type()] = new PushPromiseGenerator(bufferPool); } - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { return generators[frame.getFrameType().type()].generate(accumulator, streamId, frame, fail); } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/PushPromiseGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/PushPromiseGenerator.java index ebf95c3cdf6d..396980853626 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/PushPromiseGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/PushPromiseGenerator.java @@ -16,17 +16,17 @@ import java.util.function.Consumer; import org.eclipse.jetty.http3.frames.Frame; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class PushPromiseGenerator extends FrameGenerator { - public PushPromiseGenerator(RetainableByteBufferPool bufferPool) + public PushPromiseGenerator(ByteBufferPool bufferPool) { super(bufferPool); } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { return 0; } diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/SettingsGenerator.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/SettingsGenerator.java index 4caf1537bad0..57369aace7cb 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/SettingsGenerator.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/generator/SettingsGenerator.java @@ -20,28 +20,28 @@ import org.eclipse.jetty.http3.frames.Frame; import org.eclipse.jetty.http3.frames.SettingsFrame; import org.eclipse.jetty.http3.internal.VarLenInt; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class SettingsGenerator extends FrameGenerator { private final boolean useDirectByteBuffers; - public SettingsGenerator(RetainableByteBufferPool bufferPool, boolean useDirectByteBuffers) + public SettingsGenerator(ByteBufferPool bufferPool, boolean useDirectByteBuffers) { super(bufferPool); this.useDirectByteBuffers = useDirectByteBuffers; } @Override - public int generate(RetainableByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) + public int generate(ByteBufferPool.Accumulator accumulator, long streamId, Frame frame, Consumer fail) { SettingsFrame settingsFrame = (SettingsFrame)frame; return generateSettings(accumulator, settingsFrame); } - private int generateSettings(RetainableByteBufferPool.Accumulator accumulator, SettingsFrame frame) + private int generateSettings(ByteBufferPool.Accumulator accumulator, SettingsFrame frame) { int length = 0; Map settings = frame.getSettings(); @@ -50,7 +50,7 @@ private int generateSettings(RetainableByteBufferPool.Accumulator accumulator, S length += VarLenInt.length(e.getKey()) + VarLenInt.length(e.getValue()); } int capacity = VarLenInt.length(frame.getFrameType().type()) + VarLenInt.length(length) + length; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(capacity, useDirectByteBuffers); + RetainableByteBuffer buffer = getByteBufferPool().acquire(capacity, useDirectByteBuffers); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); VarLenInt.encode(byteBuffer, frame.getFrameType().type()); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/internal/ControlStreamConnection.java b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/internal/ControlStreamConnection.java index c3152c465639..65116f212024 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/internal/ControlStreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/main/java/org/eclipse/jetty/http3/internal/ControlStreamConnection.java @@ -18,10 +18,10 @@ import org.eclipse.jetty.http3.parser.ControlParser; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,12 +32,12 @@ public class ControlStreamConnection extends AbstractConnection implements Conne public static final long STREAM_TYPE = 0x00; private static final Logger LOG = LoggerFactory.getLogger(ControlStreamConnection.class); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final ControlParser parser; private boolean useInputDirectByteBuffers = true; private RetainableByteBuffer buffer; - public ControlStreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, ControlParser parser) + public ControlStreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, ControlParser parser) { super(endPoint, executor); this.bufferPool = bufferPool; diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/DataGenerateParseTest.java b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/DataGenerateParseTest.java index f0e003d48ef0..3161c4d84749 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/DataGenerateParseTest.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/DataGenerateParseTest.java @@ -23,7 +23,7 @@ import org.eclipse.jetty.http3.generator.MessageGenerator; import org.eclipse.jetty.http3.parser.MessageParser; import org.eclipse.jetty.http3.parser.ParserListener; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.Test; @@ -53,8 +53,8 @@ private void testGenerateParse(ByteBuffer byteBuffer) byteBuffer.get(inputBytes); DataFrame input = new DataFrame(ByteBuffer.wrap(inputBytes), true); - RetainableByteBufferPool.NonPooling bufferPool = new RetainableByteBufferPool.NonPooling(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.NonPooling bufferPool = new ByteBufferPool.NonPooling(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); new MessageGenerator(bufferPool, null, 8192, true).generate(accumulator, 0, input, null); List frames = new ArrayList<>(); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/GoAwayGenerateParseTest.java b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/GoAwayGenerateParseTest.java index a3d1dfd0903a..8aab0dd64c9f 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/GoAwayGenerateParseTest.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/GoAwayGenerateParseTest.java @@ -21,7 +21,7 @@ import org.eclipse.jetty.http3.generator.ControlGenerator; import org.eclipse.jetty.http3.parser.ControlParser; import org.eclipse.jetty.http3.parser.ParserListener; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -34,8 +34,8 @@ public void testGenerateParse() { GoAwayFrame input = GoAwayFrame.CLIENT_GRACEFUL; - RetainableByteBufferPool.NonPooling bufferPool = new RetainableByteBufferPool.NonPooling(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.NonPooling bufferPool = new ByteBufferPool.NonPooling(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); new ControlGenerator(bufferPool, true).generate(accumulator, 0, input, null); List frames = new ArrayList<>(); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/HeadersGenerateParseTest.java b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/HeadersGenerateParseTest.java index 45e2e181ca38..056835659cdc 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/HeadersGenerateParseTest.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/HeadersGenerateParseTest.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.http3.parser.ParserListener; import org.eclipse.jetty.http3.qpack.QpackDecoder; import org.eclipse.jetty.http3.qpack.QpackEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -46,9 +46,9 @@ public void testGenerateParse() .put("Cookie", "c=d"); HeadersFrame input = new HeadersFrame(new MetaData.Request(HttpMethod.GET.asString(), uri, HttpVersion.HTTP_3, fields), true); - RetainableByteBufferPool.NonPooling bufferPool = new RetainableByteBufferPool.NonPooling(); + ByteBufferPool.NonPooling bufferPool = new ByteBufferPool.NonPooling(); QpackEncoder encoder = new QpackEncoder(bufferPool, instructions -> {}, 100); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); new MessageGenerator(bufferPool, encoder, 8192, true).generate(accumulator, 0, input, null); QpackDecoder decoder = new QpackDecoder(bufferPool, instructions -> {}, 8192); diff --git a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/SettingsGenerateParseTest.java b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/SettingsGenerateParseTest.java index 38664034d3ba..12c6e51e0a5d 100644 --- a/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/SettingsGenerateParseTest.java +++ b/jetty-core/jetty-http3/jetty-http3-common/src/test/java/org/eclipse/jetty/http3/internal/SettingsGenerateParseTest.java @@ -22,7 +22,7 @@ import org.eclipse.jetty.http3.generator.ControlGenerator; import org.eclipse.jetty.http3.parser.ControlParser; import org.eclipse.jetty.http3.parser.ParserListener; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -46,8 +46,8 @@ private void testGenerateParse(Map settings) { SettingsFrame input = new SettingsFrame(settings); - RetainableByteBufferPool.NonPooling bufferPool = new RetainableByteBufferPool.NonPooling(); - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.NonPooling bufferPool = new ByteBufferPool.NonPooling(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); new ControlGenerator(bufferPool, true).generate(accumulator, 0, input, null); List frames = new ArrayList<>(); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/Instruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/Instruction.java index 66824705efaf..0bccf68a3220 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/Instruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/Instruction.java @@ -15,11 +15,11 @@ import java.util.List; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public interface Instruction { - void encode(RetainableByteBufferPool.Accumulator accumulator); + void encode(ByteBufferPool.Accumulator accumulator); /** *

A handler for instructions issued by an {@link QpackEncoder} or {@link QpackDecoder}.

diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackDecoder.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackDecoder.java index 9c667a1a7fb9..81ad2c30e5f4 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackDecoder.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackDecoder.java @@ -34,7 +34,7 @@ import org.eclipse.jetty.http3.qpack.internal.table.Entry; import org.eclipse.jetty.http3.qpack.internal.table.StaticTable; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerParser; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.component.Dumpable; import org.slf4j.Logger; @@ -56,7 +56,7 @@ public class QpackDecoder implements Dumpable private final NBitIntegerParser _integerDecoder = new NBitIntegerParser(); private final InstructionHandler _instructionHandler = new InstructionHandler(); private final Map _blockedStreams = new HashMap<>(); - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private int _maxHeaderSize; private int _maxBlockedStreams; @@ -82,7 +82,7 @@ public void notifyHandler() /** * @param maxHeaderSize The maximum allowed size of a headers block, expressed as total of all name and value characters, plus 32 per field */ - public QpackDecoder(RetainableByteBufferPool bufferPool, Instruction.Handler handler, int maxHeaderSize) + public QpackDecoder(ByteBufferPool bufferPool, Instruction.Handler handler, int maxHeaderSize) { _bufferPool = bufferPool; _context = new QpackContext(); @@ -91,7 +91,7 @@ public QpackDecoder(RetainableByteBufferPool bufferPool, Instruction.Handler han _maxHeaderSize = maxHeaderSize; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _bufferPool; } diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackEncoder.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackEncoder.java index 190a6706320d..d36a3a7e8a88 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackEncoder.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/QpackEncoder.java @@ -38,7 +38,7 @@ import org.eclipse.jetty.http3.qpack.internal.table.DynamicTable; import org.eclipse.jetty.http3.qpack.internal.table.Entry; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.thread.AutoLock; @@ -90,7 +90,7 @@ public class QpackEncoder implements Dumpable private final AutoLock lock = new AutoLock(); private final List _instructions = new ArrayList<>(); - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private final Instruction.Handler _handler; private final QpackContext _context; private int _maxBlockedStreams; @@ -100,7 +100,7 @@ public class QpackEncoder implements Dumpable private int _knownInsertCount = 0; private int _blockedStreams = 0; - public QpackEncoder(RetainableByteBufferPool bufferPool, Instruction.Handler handler, int maxBlockedStreams) + public QpackEncoder(ByteBufferPool bufferPool, Instruction.Handler handler, int maxBlockedStreams) { _bufferPool = bufferPool; _handler = handler; @@ -109,7 +109,7 @@ public QpackEncoder(RetainableByteBufferPool bufferPool, Instruction.Handler han _parser = new EncoderInstructionParser(_instructionHandler); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _bufferPool; } diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/AbstractInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/AbstractInstruction.java index 277d66e87d1e..b3627d3ded3f 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/AbstractInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/AbstractInstruction.java @@ -14,18 +14,18 @@ package org.eclipse.jetty.http3.qpack.internal.instruction; import org.eclipse.jetty.http3.qpack.Instruction; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public abstract class AbstractInstruction implements Instruction { - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; - protected AbstractInstruction(RetainableByteBufferPool bufferPool) + protected AbstractInstruction(ByteBufferPool bufferPool) { this.bufferPool = bufferPool; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/DuplicateInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/DuplicateInstruction.java index f9c6e3622290..15cbffbbe98a 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/DuplicateInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/DuplicateInstruction.java @@ -16,15 +16,15 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class DuplicateInstruction extends AbstractInstruction { private final int _index; - public DuplicateInstruction(RetainableByteBufferPool bufferPool, int index) + public DuplicateInstruction(ByteBufferPool bufferPool, int index) { super(bufferPool); _index = index; @@ -36,10 +36,10 @@ public int getIndex() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(5, _index) + 1; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.put((byte)0x00); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/IndexedNameEntryInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/IndexedNameEntryInstruction.java index 0e66dd59652c..2b315560679d 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/IndexedNameEntryInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/IndexedNameEntryInstruction.java @@ -17,8 +17,8 @@ import org.eclipse.jetty.http3.qpack.internal.util.HuffmanEncoder; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class IndexedNameEntryInstruction extends AbstractInstruction @@ -28,7 +28,7 @@ public class IndexedNameEntryInstruction extends AbstractInstruction private final boolean _huffman; private final String _value; - public IndexedNameEntryInstruction(RetainableByteBufferPool bufferPool, boolean dynamic, int index, boolean huffman, String value) + public IndexedNameEntryInstruction(ByteBufferPool bufferPool, boolean dynamic, int index, boolean huffman, String value) { super(bufferPool); _dynamic = dynamic; @@ -53,10 +53,10 @@ public String getValue() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(6, _index) + (_huffman ? HuffmanEncoder.octetsNeeded(_value) : _value.length()) + 2; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/InsertCountIncrementInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/InsertCountIncrementInstruction.java index 5bff85dc91e8..a9cbc5a4c5e8 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/InsertCountIncrementInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/InsertCountIncrementInstruction.java @@ -16,15 +16,15 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class InsertCountIncrementInstruction extends AbstractInstruction { private final int _increment; - public InsertCountIncrementInstruction(RetainableByteBufferPool bufferPool, int increment) + public InsertCountIncrementInstruction(ByteBufferPool bufferPool, int increment) { super(bufferPool); _increment = increment; @@ -36,10 +36,10 @@ public int getIncrement() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(6, _increment) + 1; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.put((byte)0x00); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/LiteralNameEntryInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/LiteralNameEntryInstruction.java index a2c2c5c26dd6..6ccd51a4c468 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/LiteralNameEntryInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/LiteralNameEntryInstruction.java @@ -18,8 +18,8 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http3.qpack.internal.util.HuffmanEncoder; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class LiteralNameEntryInstruction extends AbstractInstruction @@ -29,12 +29,12 @@ public class LiteralNameEntryInstruction extends AbstractInstruction private final String _name; private final String _value; - public LiteralNameEntryInstruction(RetainableByteBufferPool bufferPool, HttpField httpField, boolean huffman) + public LiteralNameEntryInstruction(ByteBufferPool bufferPool, HttpField httpField, boolean huffman) { this(bufferPool, httpField, huffman, huffman); } - public LiteralNameEntryInstruction(RetainableByteBufferPool bufferPool, HttpField httpField, boolean huffmanName, boolean huffmanValue) + public LiteralNameEntryInstruction(ByteBufferPool bufferPool, HttpField httpField, boolean huffmanName, boolean huffmanValue) { super(bufferPool); _huffmanName = huffmanName; @@ -54,11 +54,11 @@ public String getValue() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = (_huffmanName ? HuffmanEncoder.octetsNeeded(_name) : _name.length()) + (_huffmanValue ? HuffmanEncoder.octetsNeeded(_value) : _value.length()) + 2; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SectionAcknowledgmentInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SectionAcknowledgmentInstruction.java index 85cd979072de..be9b003c5ec9 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SectionAcknowledgmentInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SectionAcknowledgmentInstruction.java @@ -16,15 +16,15 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class SectionAcknowledgmentInstruction extends AbstractInstruction { private final long _streamId; - public SectionAcknowledgmentInstruction(RetainableByteBufferPool bufferPool, long streamId) + public SectionAcknowledgmentInstruction(ByteBufferPool bufferPool, long streamId) { super(bufferPool); _streamId = streamId; @@ -36,10 +36,10 @@ public long getStreamId() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(7, _streamId) + 1; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.put((byte)0x80); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SetCapacityInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SetCapacityInstruction.java index 9582db62b879..fc6136f43843 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SetCapacityInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/SetCapacityInstruction.java @@ -16,15 +16,15 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class SetCapacityInstruction extends AbstractInstruction { private final int _capacity; - public SetCapacityInstruction(RetainableByteBufferPool bufferPool, int capacity) + public SetCapacityInstruction(ByteBufferPool bufferPool, int capacity) { super(bufferPool); _capacity = capacity; @@ -36,10 +36,10 @@ public int getCapacity() } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(5, _capacity) + 1; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.put((byte)0x20); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/StreamCancellationInstruction.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/StreamCancellationInstruction.java index ae3ad81b59e3..f109d731a398 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/StreamCancellationInstruction.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/main/java/org/eclipse/jetty/http3/qpack/internal/instruction/StreamCancellationInstruction.java @@ -16,25 +16,25 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.http3.qpack.internal.util.NBitIntegerEncoder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; public class StreamCancellationInstruction extends AbstractInstruction { private final long _streamId; - public StreamCancellationInstruction(RetainableByteBufferPool bufferPool, long streamId) + public StreamCancellationInstruction(ByteBufferPool bufferPool, long streamId) { super(bufferPool); _streamId = streamId; } @Override - public void encode(RetainableByteBufferPool.Accumulator accumulator) + public void encode(ByteBufferPool.Accumulator accumulator) { int size = NBitIntegerEncoder.octetsNeeded(6, _streamId) + 1; - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(size, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(size, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); BufferUtil.clearToFill(byteBuffer); byteBuffer.put((byte)0x40); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/BlockedStreamsTest.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/BlockedStreamsTest.java index c72e0a9621c3..65db3d5b7b7f 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/BlockedStreamsTest.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/BlockedStreamsTest.java @@ -24,7 +24,7 @@ import org.eclipse.jetty.http3.qpack.internal.instruction.SectionAcknowledgmentInstruction; import org.eclipse.jetty.http3.qpack.internal.instruction.SetCapacityInstruction; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -56,7 +56,7 @@ public void before() { _encoderHandler = new TestEncoderHandler(); _decoderHandler = new TestDecoderHandler(); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); _encoder = new QpackEncoder(bufferPool, _encoderHandler, MAX_BLOCKED_STREAMS); _decoder = new QpackDecoder(bufferPool, _decoderHandler, MAX_HEADER_SIZE); } diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EncodeDecodeTest.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EncodeDecodeTest.java index f2b8b6baf604..352883686f3e 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EncodeDecodeTest.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EncodeDecodeTest.java @@ -28,7 +28,7 @@ import org.eclipse.jetty.http3.qpack.internal.parser.DecoderInstructionParser; import org.eclipse.jetty.http3.qpack.internal.parser.EncoderInstructionParser; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -58,7 +58,7 @@ public void before() { _encoderHandler = new TestEncoderHandler(); _decoderHandler = new TestDecoderHandler(); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); _encoder = new QpackEncoder(bufferPool, _encoderHandler, MAX_BLOCKED_STREAMS) { @Override @@ -94,7 +94,7 @@ public void test() throws Exception assertThat(_decoderHandler.getInstruction(), instanceOf(SectionAcknowledgmentInstruction.class)); assertTrue(_decoderHandler.isEmpty()); - _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new SectionAcknowledgmentInstruction(_encoder.getRetainableByteBufferPool(), streamId)))); + _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new SectionAcknowledgmentInstruction(_encoder.getByteBufferPool(), streamId)))); // B.2. Dynamic Table. @@ -146,8 +146,8 @@ public void test() throws Exception assertTrue(_decoderHandler.isEmpty()); // Parse the decoder instructions on the encoder. - _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new InsertCountIncrementInstruction(_encoder.getRetainableByteBufferPool(), 2)))); - _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new SectionAcknowledgmentInstruction(_encoder.getRetainableByteBufferPool(), streamId)))); + _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new InsertCountIncrementInstruction(_encoder.getByteBufferPool(), 2)))); + _encoderInstructionParser.parse(QpackTestUtil.toBuffer(List.of(new SectionAcknowledgmentInstruction(_encoder.getByteBufferPool(), streamId)))); // B.3. Speculative Insert _encoder.insert(new HttpField("custom-key", "custom-value")); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EvictionTest.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EvictionTest.java index a24b3664cc86..36e1e022a31d 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EvictionTest.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/EvictionTest.java @@ -21,7 +21,7 @@ import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MetaData; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ public class EvictionTest @BeforeEach public void before() { - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); _decoder = new QpackDecoder(bufferPool, _decoderHandler, MAX_HEADER_SIZE); _encoder = new QpackEncoder(bufferPool, _encoderHandler, MAX_BLOCKED_STREAMS) { diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/InstructionGeneratorTest.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/InstructionGeneratorTest.java index 42eb19789ee3..0effadc7ddc4 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/InstructionGeneratorTest.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/InstructionGeneratorTest.java @@ -16,7 +16,7 @@ import org.eclipse.jetty.http3.qpack.internal.instruction.IndexedNameEntryInstruction; import org.eclipse.jetty.http3.qpack.internal.instruction.SectionAcknowledgmentInstruction; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.Test; @@ -26,11 +26,11 @@ public class InstructionGeneratorTest { - private final RetainableByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); private String toHexString(Instruction instruction) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); instruction.encode(accumulator); assertThat(accumulator.getSize(), is(1)); return BufferUtil.toHexString(accumulator.getByteBuffers().get(0)); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/QpackTestUtil.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/QpackTestUtil.java index 4040d85cc62a..858c95012bb2 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/QpackTestUtil.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/QpackTestUtil.java @@ -20,7 +20,7 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MetaData; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; import org.hamcrest.Matcher; @@ -32,7 +32,7 @@ public class QpackTestUtil { public static ByteBuffer toBuffer(Instruction... instructions) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); for (Instruction instruction : instructions) { instruction.encode(accumulator); @@ -55,7 +55,7 @@ public static Matcher equalsHex(String expectedString) public static ByteBuffer toBuffer(List instructions) { - RetainableByteBufferPool.Accumulator accumulator = new RetainableByteBufferPool.Accumulator(); + ByteBufferPool.Accumulator accumulator = new ByteBufferPool.Accumulator(); instructions.forEach(i -> i.encode(accumulator)); assertThat(accumulator.getSize(), is(instructions.size())); ByteBuffer combinedBuffer = BufferUtil.allocate(Math.toIntExact(accumulator.getTotalLength()), false); diff --git a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/SectionAcknowledgmentTest.java b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/SectionAcknowledgmentTest.java index f58d30a74e7d..adc88e5bee79 100644 --- a/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/SectionAcknowledgmentTest.java +++ b/jetty-core/jetty-http3/jetty-http3-qpack/src/test/java/org/eclipse/jetty/http3/qpack/SectionAcknowledgmentTest.java @@ -18,7 +18,7 @@ import org.eclipse.jetty.http3.qpack.QpackException.SessionException; import org.eclipse.jetty.http3.qpack.internal.instruction.SectionAcknowledgmentInstruction; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ public void before() { _encoderHandler = new TestEncoderHandler(); _decoderHandler = new TestDecoderHandler(); - RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); _encoder = new QpackEncoder(bufferPool, _encoderHandler, MAX_BLOCKED_STREAMS); _decoder = new QpackDecoder(bufferPool, _decoderHandler, MAX_HEADER_SIZE); } @@ -77,7 +77,7 @@ public void testSectionAcknowledgmentForZeroRequiredInsertCountOnEncoder() throw assertThat(BufferUtil.remaining(buffer), greaterThan(0L)); // Parsing a section ack instruction on the encoder when we are not expecting it should result in QPACK_DECODER_STREAM_ERROR. - SectionAcknowledgmentInstruction instruction = new SectionAcknowledgmentInstruction(_encoder.getRetainableByteBufferPool(), 0); + SectionAcknowledgmentInstruction instruction = new SectionAcknowledgmentInstruction(_encoder.getByteBufferPool(), 0); ByteBuffer instructionBuffer = toBuffer(instruction); SessionException error = assertThrows(SessionException.class, () -> _encoder.parseInstructions(instructionBuffer)); assertThat(error.getErrorCode(), equalTo(QpackException.QPACK_ENCODER_STREAM_ERROR)); diff --git a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/HTTP3ServerConnector.java b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/HTTP3ServerConnector.java index dc83937ae022..b8aa6230be2f 100644 --- a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/HTTP3ServerConnector.java +++ b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/HTTP3ServerConnector.java @@ -18,7 +18,7 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.PreEncodedHttpField; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.quic.server.QuicServerConnector; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Server; @@ -44,7 +44,7 @@ public HTTP3ServerConnector(Server server, SslContextFactory.Server sslContextFa this(server, null, null, null, sslContextFactory, factories); } - public HTTP3ServerConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) + public HTTP3ServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, sslContextFactory, factories); // Max concurrent streams that a client can open. diff --git a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3Session.java b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3Session.java index 7b621be3232b..4229a6fded06 100644 --- a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3Session.java +++ b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3Session.java @@ -30,7 +30,7 @@ import org.eclipse.jetty.http3.frames.SettingsFrame; import org.eclipse.jetty.http3.qpack.QpackDecoder; import org.eclipse.jetty.http3.qpack.QpackEncoder; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.quic.common.QuicStreamEndPoint; import org.eclipse.jetty.quic.common.StreamType; import org.eclipse.jetty.quic.server.ServerProtocolSession; @@ -63,7 +63,7 @@ public ServerHTTP3Session(HTTP3Configuration configuration, ServerQuicSession qu long encoderStreamId = getQuicSession().newStreamId(StreamType.SERVER_UNIDIRECTIONAL); QuicStreamEndPoint encoderEndPoint = openInstructionEndPoint(encoderStreamId); InstructionFlusher encoderInstructionFlusher = new InstructionFlusher(quicSession, encoderEndPoint, EncoderStreamConnection.STREAM_TYPE); - RetainableByteBufferPool bufferPool = quicSession.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = quicSession.getByteBufferPool(); this.encoder = new QpackEncoder(bufferPool, new InstructionHandler(encoderInstructionFlusher), configuration.getMaxBlockedStreams()); addBean(encoder); if (LOG.isDebugEnabled()) @@ -84,7 +84,7 @@ public ServerHTTP3Session(HTTP3Configuration configuration, ServerQuicSession qu if (LOG.isDebugEnabled()) LOG.debug("created control stream #{} on {}", controlStreamId, controlEndPoint); - this.messageFlusher = new MessageFlusher(quicSession.getRetainableByteBufferPool(), encoder, configuration.getMaxResponseHeadersSize(), configuration.isUseOutputDirectByteBuffers()); + this.messageFlusher = new MessageFlusher(quicSession.getByteBufferPool(), encoder, configuration.getMaxResponseHeadersSize(), configuration.isUseOutputDirectByteBuffers()); addBean(messageFlusher); } @@ -191,7 +191,7 @@ protected void onClose(long error, String reason) private void openUnidirectionalStreamEndPoint(QuicStreamEndPoint endPoint) { - UnidirectionalStreamConnection connection = new UnidirectionalStreamConnection(endPoint, getQuicSession().getExecutor(), getQuicSession().getRetainableByteBufferPool(), encoder, decoder, session); + UnidirectionalStreamConnection connection = new UnidirectionalStreamConnection(endPoint, getQuicSession().getExecutor(), getQuicSession().getByteBufferPool(), encoder, decoder, session); endPoint.setConnection(connection); endPoint.opened(); } diff --git a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3StreamConnection.java b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3StreamConnection.java index b80f0526501d..b2a142c031f0 100644 --- a/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3StreamConnection.java +++ b/jetty-core/jetty-http3/jetty-http3-server/src/main/java/org/eclipse/jetty/http3/server/internal/ServerHTTP3StreamConnection.java @@ -42,7 +42,7 @@ public class ServerHTTP3StreamConnection extends HTTP3StreamConnection implement public ServerHTTP3StreamConnection(Connector connector, HttpConfiguration httpConfiguration, QuicStreamEndPoint endPoint, ServerHTTP3Session session, MessageParser parser) { - super(endPoint, connector.getExecutor(), connector.getRetainableByteBufferPool(), parser); + super(endPoint, connector.getExecutor(), connector.getByteBufferPool(), parser); this.connector = connector; this.httpConfiguration = httpConfiguration; this.session = session; diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayRetainableByteBufferPool.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayRetainableByteBufferPool.java index 58d74f79fb80..4f69851bfbdc 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayRetainableByteBufferPool.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayRetainableByteBufferPool.java @@ -43,7 +43,7 @@ * divided by 8.

*/ @ManagedObject -public class ArrayRetainableByteBufferPool implements RetainableByteBufferPool, Dumpable +public class ArrayRetainableByteBufferPool implements ByteBufferPool, Dumpable { private static final Logger LOG = LoggerFactory.getLogger(ArrayRetainableByteBufferPool.class); static final int DEFAULT_FACTOR = 4096; @@ -336,7 +336,7 @@ private long getAvailableMemory(boolean direct) return total; } - @ManagedOperation(value = "Clears this RetainableByteBufferPool", impact = "ACTION") + @ManagedOperation(value = "Clears this ByteBufferPool", impact = "ACTION") public void clear() { clearArray(_direct, _currentDirectMemory); diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java index 90f05e773ef0..b279152a6035 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferAccumulator.java @@ -24,7 +24,7 @@ /** * Accumulates data into a list of ByteBuffers which can then be combined into a single buffer or written to an OutputStream. * The buffer list automatically grows as data is written to it, the buffers are taken from the - * supplied {@link RetainableByteBufferPool} or freshly allocated if one is not supplied. + * supplied {@link ByteBufferPool} or freshly allocated if one is not supplied. * * The method {@link #ensureBuffer(int, int)} is used to write directly to the last buffer stored in the buffer list, * if there is less than a certain amount of space available in that buffer then a new one will be allocated and returned instead. @@ -34,7 +34,7 @@ public class ByteBufferAccumulator implements AutoCloseable { private final List _buffers = new ArrayList<>(); - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private final boolean _direct; public ByteBufferAccumulator() @@ -42,9 +42,9 @@ public ByteBufferAccumulator() this(null, false); } - public ByteBufferAccumulator(RetainableByteBufferPool bufferPool, boolean direct) + public ByteBufferAccumulator(ByteBufferPool bufferPool, boolean direct) { - _bufferPool = (bufferPool == null) ? new RetainableByteBufferPool.NonPooling() : bufferPool; + _bufferPool = (bufferPool == null) ? new ByteBufferPool.NonPooling() : bufferPool; _direct = direct; } diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferOutputStream2.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferOutputStream2.java index fd8fda345e8b..5267815dec9b 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferOutputStream2.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferOutputStream2.java @@ -20,7 +20,7 @@ /** * This class implements an output stream in which the data is written into a list of ByteBuffer, * the buffer list automatically grows as data is written to it, the buffers are taken from the - * supplied {@link RetainableByteBufferPool} or freshly allocated if one is not supplied. + * supplied {@link ByteBufferPool} or freshly allocated if one is not supplied. * * Designed to mimic {@link java.io.ByteArrayOutputStream} but with better memory usage, and less copying. */ @@ -34,9 +34,9 @@ public ByteBufferOutputStream2() this(null, false); } - public ByteBufferOutputStream2(RetainableByteBufferPool bufferPool, boolean direct) + public ByteBufferOutputStream2(ByteBufferPool bufferPool, boolean direct) { - _accumulator = new ByteBufferAccumulator(bufferPool == null ? new RetainableByteBufferPool.NonPooling() : bufferPool, direct); + _accumulator = new ByteBufferAccumulator(bufferPool == null ? new ByteBufferPool.NonPooling() : bufferPool, direct); } /** diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBufferPool.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java similarity index 92% rename from jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBufferPool.java rename to jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java index d031144c622d..db617d4d5669 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBufferPool.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java @@ -43,7 +43,7 @@ * buffer returned by {@link #acquire(int, boolean)} must be wrapped, see * {@link RetainableByteBuffer.Wrapper}

*/ -public interface RetainableByteBufferPool +public interface ByteBufferPool { /** *

Acquires a {@link RetainableByteBuffer} from this pool.

@@ -61,18 +61,18 @@ public interface RetainableByteBufferPool void clear(); /** - *

A wrapper for {@link RetainableByteBufferPool} instances.

+ *

A wrapper for {@link ByteBufferPool} instances.

*/ - class Wrapper implements RetainableByteBufferPool + class Wrapper implements ByteBufferPool { - private final RetainableByteBufferPool wrapped; + private final ByteBufferPool wrapped; - public Wrapper(RetainableByteBufferPool wrapped) + public Wrapper(ByteBufferPool wrapped) { this.wrapped = wrapped; } - public RetainableByteBufferPool getWrapped() + public ByteBufferPool getWrapped() { return wrapped; } @@ -91,7 +91,7 @@ public void clear() } /** - *

A {@link RetainableByteBufferPool} that does not pool its + *

A {@link ByteBufferPool} that does not pool its * {@link RetainableByteBuffer}s.

*

The returned {@code RetainableByteBuffer}s are reference * counted.

@@ -102,7 +102,7 @@ public void clear() * * @see RetainableByteBuffer#wrap(ByteBuffer) */ - class NonPooling implements RetainableByteBufferPool + class NonPooling implements ByteBufferPool { @Override public RetainableByteBuffer acquire(int size, boolean direct) diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java index df900ad99b88..216747747d96 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ClientConnector.java @@ -94,7 +94,7 @@ public static ClientConnector forUnixDomain(Path path) private final Configurator configurator; private Executor executor; private Scheduler scheduler; - private RetainableByteBufferPool retainableByteBufferPool; + private ByteBufferPool byteBufferPool; private SslContextFactory.Client sslContextFactory; private SelectorManager selectorManager; private int selectors = 1; @@ -155,17 +155,17 @@ public void setScheduler(Scheduler scheduler) this.scheduler = scheduler; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return retainableByteBufferPool; + return byteBufferPool; } - public void setRetainableByteBufferPool(RetainableByteBufferPool retainableByteBufferPool) + public void setByteBufferPool(ByteBufferPool byteBufferPool) { if (isStarted()) throw new IllegalStateException(); - updateBean(this.retainableByteBufferPool, retainableByteBufferPool); - this.retainableByteBufferPool = retainableByteBufferPool; + updateBean(this.byteBufferPool, byteBufferPool); + this.byteBufferPool = byteBufferPool; } public SslContextFactory.Client getSslContextFactory() @@ -366,8 +366,8 @@ protected void doStart() throws Exception } if (scheduler == null) setScheduler(new ScheduledExecutorScheduler(String.format("client-scheduler@%x", hashCode()), false)); - if (retainableByteBufferPool == null) - setRetainableByteBufferPool(new ArrayRetainableByteBufferPool()); + if (byteBufferPool == null) + setByteBufferPool(new ArrayRetainableByteBufferPool()); if (sslContextFactory == null) setSslContextFactory(newSslContextFactory()); selectorManager = newSelectorManager(); diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java index 38e2b5f4cc27..3555e35aa07c 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/RetainableByteBuffer.java @@ -21,7 +21,7 @@ /** *

A pooled {@link ByteBuffer} which maintains a reference count that is * incremented with {@link #retain()} and decremented with {@link #release()}.

- *

The {@code ByteBuffer} is released to a {@link RetainableByteBufferPool} + *

The {@code ByteBuffer} is released to a {@link ByteBufferPool} * when {@link #release()} is called one more time than {@link #retain()}; * in such case, the call to {@link #release()} returns {@code true}.

*

A {@code RetainableByteBuffer} can either be:

@@ -50,7 +50,7 @@ public interface RetainableByteBuffer extends Retainable * * @param byteBuffer the {@code ByteBuffer} to wrap * @return a non-retainable {@code RetainableByteBuffer} - * @see RetainableByteBufferPool.NonPooling + * @see ByteBufferPool.NonPooling */ public static RetainableByteBuffer wrap(ByteBuffer byteBuffer) { diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/InputStreamContentSource.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/InputStreamContentSource.java index 3f50132771d1..3c42edbc4982 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/InputStreamContentSource.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/InputStreamContentSource.java @@ -16,9 +16,9 @@ import java.io.InputStream; import java.nio.ByteBuffer; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.thread.AutoLock; import org.eclipse.jetty.util.thread.SerializedInvoker; @@ -27,9 +27,9 @@ *

* A {@link Content.Source} that is backed by an {@link InputStream}. * Data is read from the {@link InputStream} into a buffer that is optionally acquired - * from a {@link RetainableByteBufferPool}, and converted to a {@link Content.Chunk} that is - * returned from {@link #read()}. If no {@link RetainableByteBufferPool} is provided, then - * a {@link RetainableByteBufferPool.NonPooling} is used. + * from a {@link ByteBufferPool}, and converted to a {@link Content.Chunk} that is + * returned from {@link #read()}. If no {@link ByteBufferPool} is provided, then + * a {@link ByteBufferPool.NonPooling} is used. *

*/ public class InputStreamContentSource implements Content.Source @@ -37,7 +37,7 @@ public class InputStreamContentSource implements Content.Source private final AutoLock lock = new AutoLock(); private final SerializedInvoker invoker = new SerializedInvoker(); private final InputStream inputStream; - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private int bufferSize = 4096; private Runnable demandCallback; private Content.Chunk.Error errorChunk; @@ -48,10 +48,10 @@ public InputStreamContentSource(InputStream inputStream) this(inputStream, null); } - public InputStreamContentSource(InputStream inputStream, RetainableByteBufferPool bufferPool) + public InputStreamContentSource(InputStream inputStream, ByteBufferPool bufferPool) { this.inputStream = inputStream; - this.bufferPool = bufferPool != null ? bufferPool : new RetainableByteBufferPool.NonPooling(); + this.bufferPool = bufferPool != null ? bufferPool : new ByteBufferPool.NonPooling(); } public int getBufferSize() diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/PathContentSource.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/PathContentSource.java index 04e05a6eb700..9e2227a2baed 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/PathContentSource.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/PathContentSource.java @@ -23,9 +23,9 @@ import java.nio.file.Path; import java.nio.file.StandardOpenOption; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.thread.AutoLock; @@ -40,7 +40,7 @@ public class PathContentSource implements Content.Source private final SerializedInvoker invoker = new SerializedInvoker(); private final Path path; private final long length; - private final RetainableByteBufferPool byteBufferPool; + private final ByteBufferPool byteBufferPool; private int bufferSize = 4096; private boolean useDirectByteBuffers = true; private SeekableByteChannel channel; @@ -53,7 +53,7 @@ public PathContentSource(Path path) this(path, null); } - public PathContentSource(Path path, RetainableByteBufferPool byteBufferPool) + public PathContentSource(Path path, ByteBufferPool byteBufferPool) { try { @@ -63,7 +63,7 @@ public PathContentSource(Path path, RetainableByteBufferPool byteBufferPool) throw new AccessDeniedException(path.toString()); this.path = path; this.length = Files.size(path); - this.byteBufferPool = byteBufferPool != null ? byteBufferPool : new RetainableByteBufferPool.NonPooling(); + this.byteBufferPool = byteBufferPool != null ? byteBufferPool : new ByteBufferPool.NonPooling(); } catch (IOException x) { diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java index 826cab328134..9e166e495503 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslClientConnectionFactory.java @@ -24,11 +24,11 @@ import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.ssl.SslContextFactory; @@ -40,17 +40,17 @@ public class SslClientConnectionFactory implements ClientConnectionFactory public static final String SSL_ENGINE_CONTEXT_KEY = "org.eclipse.jetty.client.ssl.engine"; private final SslContextFactory sslContextFactory; - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private final Executor executor; private final ClientConnectionFactory connectionFactory; private boolean _directBuffersForEncryption = true; private boolean _directBuffersForDecryption = true; private boolean _requireCloseMessage; - public SslClientConnectionFactory(SslContextFactory sslContextFactory, RetainableByteBufferPool retainableByteBufferPool, Executor executor, ClientConnectionFactory connectionFactory) + public SslClientConnectionFactory(SslContextFactory sslContextFactory, ByteBufferPool byteBufferPool, Executor executor, ClientConnectionFactory connectionFactory) { this.sslContextFactory = Objects.requireNonNull(sslContextFactory, "Missing SslContextFactory"); - this.retainableByteBufferPool = retainableByteBufferPool; + this.byteBufferPool = byteBufferPool; this.executor = executor; this.connectionFactory = connectionFactory; } @@ -119,7 +119,7 @@ public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map handshakeListeners = new ArrayList<>(); private final AtomicLong _bytesIn = new AtomicLong(); private final AtomicLong _bytesOut = new AtomicLong(); - private final RetainableByteBufferPool _retainableByteBufferPool; + private final ByteBufferPool _retainableByteBufferPool; private final SSLEngine _sslEngine; private final DecryptedEndPoint _decryptedEndPoint; private final boolean _encryptedDirectBuffers; @@ -164,18 +164,18 @@ public String toString() } }; - public SslConnection(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine) + public SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine) { - this(retainableByteBufferPool, executor, endPoint, sslEngine, false, false); + this(byteBufferPool, executor, endPoint, sslEngine, false, false); } - public SslConnection(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine, + public SslConnection(ByteBufferPool byteBufferPool, Executor executor, EndPoint endPoint, SSLEngine sslEngine, boolean useDirectBuffersForEncryption, boolean useDirectBuffersForDecryption) { // This connection does not execute calls to onFillable(), so they will be called by the selector thread. // onFillable() does not block and will only wakeup another thread to do the actual reading and handling. super(endPoint, executor); - this._retainableByteBufferPool = retainableByteBufferPool; + this._retainableByteBufferPool = byteBufferPool; this._sslEngine = sslEngine; this._decryptedEndPoint = newDecryptedEndPoint(); this._encryptedDirectBuffers = useDirectBuffersForEncryption; diff --git a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/ByteBufferAccumulatorTest.java b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/ByteBufferAccumulatorTest.java index 758c547762aa..10a0d0bf966b 100644 --- a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/ByteBufferAccumulatorTest.java +++ b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/ByteBufferAccumulatorTest.java @@ -292,7 +292,7 @@ private int writeInFlushMode(ByteBuffer from, ByteBuffer to) return written; } - private static class CountingBufferPool extends RetainableByteBufferPool.Wrapper + private static class CountingBufferPool extends ByteBufferPool.Wrapper { private final AtomicLong _acquires = new AtomicLong(); diff --git a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java index 14231895da13..ee8a9e6ca9e6 100644 --- a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java +++ b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SocketChannelEndPointTest.java @@ -616,7 +616,7 @@ public static class SslScenario implements Scenario { private final NormalScenario _normalScenario; private final SslContextFactory _sslCtxFactory = new SslContextFactory.Server(); - private final RetainableByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); public SslScenario(NormalScenario normalScenario) throws Exception { diff --git a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java index 6adaff8ac1fb..c07c5a45125b 100644 --- a/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java +++ b/jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java @@ -61,7 +61,7 @@ public class SslConnectionTest private static final int TIMEOUT = 1000000; // TODO: track leaks - private final RetainableByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool _bufferPool = new ArrayRetainableByteBufferPool(); private final SslContextFactory _sslCtxFactory = new SslContextFactory.Server(); protected volatile EndPoint _lastEndp; private volatile boolean _testFill = true; diff --git a/jetty-core/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ForwardProxyWithDynamicTransportTest.java b/jetty-core/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ForwardProxyWithDynamicTransportTest.java index 8108ac1dd3d0..6f6a82aab798 100644 --- a/jetty-core/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ForwardProxyWithDynamicTransportTest.java +++ b/jetty-core/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ForwardProxyWithDynamicTransportTest.java @@ -403,7 +403,7 @@ public void testHTTP2TunnelResetByClient() throws Exception @Override protected DownstreamConnection newDownstreamConnection(EndPoint endPoint, ConcurrentMap context) { - return new DownstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), context) + return new DownstreamConnection(endPoint, getExecutor(), getByteBufferPool(), context) { @Override protected void close(Throwable failure) @@ -417,7 +417,7 @@ protected void close(Throwable failure) @Override protected UpstreamConnection newUpstreamConnection(EndPoint endPoint, ConnectContext connectContext) { - return new UpstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), connectContext) + return new UpstreamConnection(endPoint, getExecutor(), getByteBufferPool(), connectContext) { @Override protected void close(Throwable failure) @@ -485,7 +485,7 @@ public void testHTTP2TunnelProxyStreamTimeout() throws Exception @Override protected DownstreamConnection newDownstreamConnection(EndPoint endPoint, ConcurrentMap context) { - return new DownstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), context) + return new DownstreamConnection(endPoint, getExecutor(), getByteBufferPool(), context) { @Override protected void close(Throwable failure) @@ -499,7 +499,7 @@ protected void close(Throwable failure) @Override protected UpstreamConnection newUpstreamConnection(EndPoint endPoint, ConnectContext connectContext) { - return new UpstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), connectContext) + return new UpstreamConnection(endPoint, getExecutor(), getByteBufferPool(), connectContext) { @Override protected void close(Throwable failure) diff --git a/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicConnection.java b/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicConnection.java index a63456cb9c3f..c33be6dddc93 100644 --- a/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicConnection.java +++ b/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicConnection.java @@ -55,7 +55,7 @@ public class ClientQuicConnection extends QuicConnection public ClientQuicConnection(ClientConnector connector, EndPoint endPoint, Map context) { - super(connector.getExecutor(), connector.getScheduler(), connector.getRetainableByteBufferPool(), endPoint); + super(connector.getExecutor(), connector.getScheduler(), connector.getByteBufferPool(), endPoint); this.connector = connector; this.context = context; } @@ -97,7 +97,7 @@ public void onOpen() LOG.debug("connecting to {} with protocols {}", remoteAddress, protocols); QuicheConnection quicheConnection = QuicheConnection.connect(quicheConfig, getEndPoint().getLocalAddress(), remoteAddress); - ClientQuicSession session = new ClientQuicSession(getExecutor(), getScheduler(), getRetainableByteBufferPool(), quicheConnection, this, remoteAddress, context); + ClientQuicSession session = new ClientQuicSession(getExecutor(), getScheduler(), getByteBufferPool(), quicheConnection, this, remoteAddress, context); pendingSessions.put(remoteAddress, session); if (LOG.isDebugEnabled()) LOG.debug("created {}", session); diff --git a/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicSession.java b/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicSession.java index 102a6ef75ef3..80ca5833cbbf 100644 --- a/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicSession.java +++ b/jetty-core/jetty-quic/jetty-quic-client/src/main/java/org/eclipse/jetty/quic/client/ClientQuicSession.java @@ -19,10 +19,10 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.quic.common.ProtocolSession; import org.eclipse.jetty.quic.common.QuicConnection; @@ -43,9 +43,9 @@ public class ClientQuicSession extends QuicSession private final Map context; private final AtomicReference task = new AtomicReference<>(); - protected ClientQuicSession(Executor executor, Scheduler scheduler, RetainableByteBufferPool retainableByteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, InetSocketAddress remoteAddress, Map context) + protected ClientQuicSession(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, InetSocketAddress remoteAddress, Map context) { - super(executor, scheduler, retainableByteBufferPool, quicheConnection, connection, remoteAddress); + super(executor, scheduler, byteBufferPool, quicheConnection, connection, remoteAddress); this.context = context; } diff --git a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java index db6e418c87f9..23b750dc1175 100644 --- a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java +++ b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java @@ -27,11 +27,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.DatagramChannelEndPoint; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.internal.QuicErrorCode; import org.eclipse.jetty.quic.quiche.QuicheConnectionId; import org.eclipse.jetty.util.BufferUtil; @@ -60,7 +60,7 @@ public abstract class QuicConnection extends AbstractConnection private final ConcurrentMap sessions = new ConcurrentHashMap<>(); private final AtomicBoolean closed = new AtomicBoolean(); private final Scheduler scheduler; - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final AdaptiveExecutionStrategy strategy; private final Flusher flusher = new Flusher(); private final Callback fillableCallback = new FillableCallback(); @@ -68,7 +68,7 @@ public abstract class QuicConnection extends AbstractConnection private boolean useInputDirectByteBuffers = true; private boolean useOutputDirectByteBuffers = true; - protected QuicConnection(Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, EndPoint endPoint) + protected QuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, EndPoint endPoint) { super(endPoint, executor); if (!(endPoint instanceof DatagramChannelEndPoint)) @@ -89,7 +89,7 @@ public Scheduler getScheduler() return scheduler; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicSession.java b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicSession.java index 14bb3634c42c..857c0cf56671 100644 --- a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicSession.java +++ b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicSession.java @@ -30,11 +30,11 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.CyclicTimeout; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.internal.QuicErrorCode; import org.eclipse.jetty.quic.quiche.QuicheConnection; import org.eclipse.jetty.quic.quiche.QuicheConnectionId; @@ -66,7 +66,7 @@ public abstract class QuicSession extends ContainerLifeCycle private final ConcurrentMap endPoints = new ConcurrentHashMap<>(); private final Executor executor; private final Scheduler scheduler; - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private final QuicheConnection quicheConnection; private final QuicConnection connection; private final Flusher flusher; @@ -75,11 +75,11 @@ public abstract class QuicSession extends ContainerLifeCycle private QuicheConnectionId quicheConnectionId; private long idleTimeout; - protected QuicSession(Executor executor, Scheduler scheduler, RetainableByteBufferPool retainableByteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress) + protected QuicSession(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress) { this.executor = executor; this.scheduler = scheduler; - this.retainableByteBufferPool = retainableByteBufferPool; + this.byteBufferPool = byteBufferPool; this.quicheConnection = quicheConnection; this.connection = connection; this.flusher = new Flusher(scheduler); @@ -150,9 +150,9 @@ public Scheduler getScheduler() return scheduler; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return retainableByteBufferPool; + return byteBufferPool; } public ProtocolSession getProtocolSession() @@ -466,7 +466,7 @@ public void close() @Override protected Action process() throws IOException { - cipherBuffer = retainableByteBufferPool.acquire(connection.getOutputBufferSize(), connection.isUseOutputDirectByteBuffers()); + cipherBuffer = byteBufferPool.acquire(connection.getOutputBufferSize(), connection.isUseOutputDirectByteBuffers()); ByteBuffer cipherByteBuffer = cipherBuffer.getByteBuffer(); int pos = BufferUtil.flipToFill(cipherByteBuffer); int drained = quicheConnection.drainCipherBytes(cipherByteBuffer); diff --git a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/QuicServerConnector.java b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/QuicServerConnector.java index 5e73e81d46b9..0d10efa4afad 100644 --- a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/QuicServerConnector.java +++ b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/QuicServerConnector.java @@ -26,11 +26,11 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.DatagramChannelEndPoint; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.ManagedSelector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.quic.common.QuicConfiguration; import org.eclipse.jetty.quic.common.QuicSession; @@ -74,7 +74,7 @@ public QuicServerConnector(Server server, SslContextFactory.Server sslContextFac this(server, null, null, null, sslContextFactory, factories); } - public QuicServerConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) + public QuicServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, 0, factories); this.selectorManager = new ServerDatagramSelectorManager(getExecutor(), getScheduler(), 1); diff --git a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicConnection.java b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicConnection.java index 58d5713d1042..310222a126db 100644 --- a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicConnection.java +++ b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicConnection.java @@ -19,10 +19,10 @@ import java.nio.ByteBuffer; import java.util.Iterator; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.CyclicTimeouts; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.quic.common.QuicConnection; import org.eclipse.jetty.quic.common.QuicSession; import org.eclipse.jetty.quic.quiche.QuicheConnection; @@ -46,7 +46,7 @@ public class ServerQuicConnection extends QuicConnection protected ServerQuicConnection(QuicServerConnector connector, EndPoint endPoint) { - super(connector.getExecutor(), connector.getScheduler(), connector.getRetainableByteBufferPool(), endPoint); + super(connector.getExecutor(), connector.getScheduler(), connector.getByteBufferPool(), endPoint); this.connector = connector; this.sessionTimeouts = new SessionTimeouts(connector.getScheduler()); } @@ -61,7 +61,7 @@ public void onOpen() @Override protected QuicSession createSession(SocketAddress remoteAddress, ByteBuffer cipherBuffer) throws IOException { - RetainableByteBufferPool bufferPool = getRetainableByteBufferPool(); + ByteBufferPool bufferPool = getByteBufferPool(); // TODO make the token validator configurable QuicheConnection quicheConnection = QuicheConnection.tryAccept(connector.newQuicheConfig(), new SimpleTokenValidator((InetSocketAddress)remoteAddress), cipherBuffer, getEndPoint().getLocalAddress(), remoteAddress); if (quicheConnection == null) diff --git a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicSession.java b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicSession.java index 55cf5a1645d9..021081f21787 100644 --- a/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicSession.java +++ b/jetty-core/jetty-quic/jetty-quic-server/src/main/java/org/eclipse/jetty/quic/server/ServerQuicSession.java @@ -20,9 +20,9 @@ import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.CyclicTimeouts; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.quic.common.ProtocolSession; import org.eclipse.jetty.quic.common.QuicConnection; @@ -46,7 +46,7 @@ public class ServerQuicSession extends QuicSession implements CyclicTimeouts.Exp private final Connector connector; private long expireNanoTime; - protected ServerQuicSession(Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress, Connector connector) + protected ServerQuicSession(Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress, Connector connector) { super(executor, scheduler, bufferPool, quicheConnection, connection, remoteAddress); this.connector = connector; diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 75e2fbe7751b..bad54a3cab1f 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -32,9 +32,9 @@ import java.util.stream.Collectors; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.server.internal.HttpConnection; import org.eclipse.jetty.util.ProcessorUtils; @@ -65,7 +65,7 @@ * to the connections to time such things as asynchronous request timeouts. The default is to use a new * {@link ScheduledExecutorScheduler} instance. * - *
  • The {@link RetainableByteBufferPool} service is made available to all connections to be used to acquire and release + *
  • The {@link ByteBufferPool} service is made available to all connections to be used to acquire and release * {@link RetainableByteBuffer} instances from a pool. The default is to use a new {@link ArrayRetainableByteBufferPool} * instance. *
  • @@ -145,7 +145,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co private final Server _server; private final Executor _executor; private final Scheduler _scheduler; - private final RetainableByteBufferPool _retainableByteBufferPool; + private final ByteBufferPool _retainableByteBufferPool; private final Thread[] _acceptors; private final Set _endpoints = Collections.newSetFromMap(new ConcurrentHashMap<>()); private final Set _immutableEndPoints = Collections.unmodifiableSet(_endpoints); @@ -164,7 +164,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co * @param server The {@link Server} this connector will be added to, must not be null * @param executor An {@link Executor} for this connector or null to use the Server's Executor * @param scheduler A {@link Scheduler} for this connector or null to use the Server's Scheduler - * @param bufferPool A {@link RetainableByteBufferPool} for this connector or null to use the Server's RetainableByteBufferPool + * @param bufferPool A {@link ByteBufferPool} for this connector or null to use the Server's ByteBufferPool * @param acceptors the number of acceptor threads to use, or -1 for a default value. * If 0, then no acceptor threads will be launched and some other mechanism will need to be used to accept new connections. * @param factories The {@link ConnectionFactory} instances to use @@ -173,7 +173,7 @@ public AbstractConnector( Server server, Executor executor, Scheduler scheduler, - RetainableByteBufferPool bufferPool, + ByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) { @@ -185,7 +185,7 @@ public AbstractConnector( _scheduler = scheduler != null ? scheduler : _server.getScheduler(); addBean(_scheduler, scheduler != null); - _retainableByteBufferPool = bufferPool != null ? bufferPool : server.getRetainableByteBufferPool(); + _retainableByteBufferPool = bufferPool != null ? bufferPool : server.getByteBufferPool(); addBean(_retainableByteBufferPool, bufferPool != null); for (ConnectionFactory factory : factories) @@ -214,7 +214,7 @@ public Executor getExecutor() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _retainableByteBufferPool; } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java index 3435ac7e1090..6e0a0bea9b0e 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java @@ -17,7 +17,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.thread.Scheduler; @@ -33,7 +33,7 @@ public abstract class AbstractNetworkConnector extends AbstractConnector impleme private volatile String _host; private volatile int _port = 0; - public AbstractNetworkConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) + public AbstractNetworkConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, acceptors, factories); } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Components.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Components.java index b605f45c533a..e3ef0ec52d68 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Components.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Components.java @@ -13,7 +13,7 @@ package org.eclipse.jetty.server; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.util.thread.ThreadPool; @@ -23,7 +23,7 @@ */ public interface Components { - RetainableByteBufferPool getRetainableByteBufferPool(); + ByteBufferPool getByteBufferPool(); Scheduler getScheduler(); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionMetaData.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionMetaData.java index 1fe6c1c44a13..8b7b68d42e5f 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionMetaData.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ConnectionMetaData.java @@ -38,7 +38,7 @@ public interface ConnectionMetaData extends Attributes Connection getConnection(); // TODO should this be only here or only on HttpChannel, should not be on both. - // Currently mostly used to get stuff like RetainableByteBufferPool and Scheduler - maybe provide those directly? + // Currently mostly used to get stuff like ByteBufferPool and Scheduler - maybe provide those directly? Connector getConnector(); boolean isPersistent(); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java index 59721ff09f7c..4f6e72ba719e 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java @@ -17,8 +17,8 @@ import java.util.List; import java.util.concurrent.Executor; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @@ -51,9 +51,9 @@ public interface Connector extends LifeCycle, Container, Graceful public Scheduler getScheduler(); /** - * @return the {@link RetainableByteBufferPool} to acquire buffers from and release buffers to + * @return the {@link ByteBufferPool} to acquire buffers from and release buffers to */ - public RetainableByteBufferPool getRetainableByteBufferPool(); + public ByteBufferPool getByteBufferPool(); /** * @param nextProtocol the next protocol diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/DetectorConnectionFactory.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/DetectorConnectionFactory.java index 5e1a05c16922..0358bf07e16c 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/DetectorConnectionFactory.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/DetectorConnectionFactory.java @@ -146,7 +146,7 @@ private DetectorConnection(EndPoint endp, Connector connector) { super(endp, connector.getExecutor()); _connector = connector; - _buffer = connector.getRetainableByteBufferPool().acquire(getInputBufferSize(), true); + _buffer = connector.getByteBufferPool().acquire(getInputBufferSize(), true); } @Override diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java index 61733866f4af..7ed0d98a85a4 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java @@ -26,8 +26,8 @@ import org.eclipse.jetty.http.HttpParser; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.ByteArrayEndPoint; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.ByteArrayOutputStream2; import org.eclipse.jetty.util.ssl.SslContextFactory; @@ -46,7 +46,7 @@ public class LocalConnector extends AbstractConnector { private final BlockingQueue _connects = new LinkedBlockingQueue<>(); - public LocalConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) + public LocalConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, acceptors, factories); setIdleTimeout(30000); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NetworkTrafficServerConnector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NetworkTrafficServerConnector.java index fd34d134e55e..d7137ab91b2c 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NetworkTrafficServerConnector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NetworkTrafficServerConnector.java @@ -17,10 +17,10 @@ import java.nio.channels.SocketChannel; import java.util.concurrent.Executor; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ManagedSelector; import org.eclipse.jetty.io.NetworkTrafficListener; import org.eclipse.jetty.io.NetworkTrafficSocketChannelEndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SocketChannelEndPoint; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.Scheduler; @@ -49,7 +49,7 @@ public NetworkTrafficServerConnector(Server server, ConnectionFactory connection super(server, connectionFactory); } - public NetworkTrafficServerConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, int acceptors, int selectors, ConnectionFactory... factories) + public NetworkTrafficServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, int selectors, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, acceptors, selectors, factories); } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ProxyConnectionFactory.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ProxyConnectionFactory.java index 20d8d8439ed5..8a3d8fe712f8 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ProxyConnectionFactory.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ProxyConnectionFactory.java @@ -158,7 +158,7 @@ private ProxyProtocolV1Connection(EndPoint endp, Connector connector, Connection super(endp, connector.getExecutor()); _connector = connector; _next = next; - _buffer = _connector.getRetainableByteBufferPool().acquire(getInputBufferSize(), true); + _buffer = _connector.getByteBufferPool().acquire(getInputBufferSize(), true); } @Override @@ -451,7 +451,7 @@ protected ProxyProtocolV2Connection(EndPoint endp, Connector connector, Connecti super(endp, connector.getExecutor()); _connector = connector; _next = next; - _buffer = _connector.getRetainableByteBufferPool().acquire(getInputBufferSize(), true); + _buffer = _connector.getByteBufferPool().acquire(getInputBufferSize(), true); } @Override diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java index 10b6cc240f79..a1f2dbb6b8ac 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java @@ -40,9 +40,9 @@ import org.eclipse.jetty.http.QuotedQualityCSV; import org.eclipse.jetty.http.content.HttpContent; import org.eclipse.jetty.http.content.PreCompressedHttpContent; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; @@ -863,7 +863,7 @@ public ContentWriterIteratingCallback(HttpContent content, Response target, Call this.source = content.getResource().newReadableByteChannel(); this.sink = target; this.callback = callback; - RetainableByteBufferPool bufferPool = target.getRequest().getComponents().getRetainableByteBufferPool(); + ByteBufferPool bufferPool = target.getRequest().getComponents().getByteBufferPool(); int outputBufferSize = target.getRequest().getConnectionMetaData().getHttpConfiguration().getOutputBufferSize(); boolean useOutputDirectByteBuffers = target.getRequest().getConnectionMetaData().getHttpConfiguration().isUseOutputDirectByteBuffers(); this.buffer = bufferPool.acquire(outputBufferSize, useOutputDirectByteBuffers); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java index 89b5b0714d70..e98ea011749a 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java @@ -36,8 +36,8 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.PreEncodedHttpField; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ErrorProcessor; import org.eclipse.jetty.util.Attributes; @@ -76,7 +76,7 @@ public class Server extends Handler.Wrapper implements Attributes private final AttributeContainerMap _attributes = new AttributeContainerMap(); private final ThreadPool _threadPool; private final Scheduler _scheduler; - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private final List _connectors = new CopyOnWriteArrayList<>(); private final Context _serverContext = new ServerContext(); private final AutoLock _dateLock = new AutoLock(); @@ -136,7 +136,7 @@ public Server(@Name("threadPool") ThreadPool pool) this(pool, null, null); } - public Server(@Name("threadPool") ThreadPool threadPool, @Name("scheduler") Scheduler scheduler, @Name("bufferPool") RetainableByteBufferPool bufferPool) + public Server(@Name("threadPool") ThreadPool threadPool, @Name("scheduler") Scheduler scheduler, @Name("bufferPool") ByteBufferPool bufferPool) { _threadPool = threadPool != null ? threadPool : new QueuedThreadPool(); addBean(_threadPool); @@ -420,7 +420,7 @@ public Scheduler getScheduler() return _scheduler; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _bufferPool; } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java index e7998bec1eda..8d688a749531 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java @@ -30,10 +30,10 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.ManagedSelector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SocketChannelEndPoint; import org.eclipse.jetty.util.IO; @@ -204,7 +204,7 @@ public ServerConnector( @Name("server") Server server, @Name("executor") Executor executor, @Name("scheduler") Scheduler scheduler, - @Name("bufferPool") RetainableByteBufferPool bufferPool, + @Name("bufferPool") ByteBufferPool bufferPool, @Name("acceptors") int acceptors, @Name("selectors") int selectors, @Name("factories") ConnectionFactory... factories) diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java index 407bacb068eb..2e4e0ec67264 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/SslConnectionFactory.java @@ -21,9 +21,9 @@ import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.io.ssl.SslHandshakeListener; import org.eclipse.jetty.util.annotation.Name; @@ -166,8 +166,8 @@ public Connection newConnection(Connector connector, EndPoint endPoint) protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - RetainableByteBufferPool retainableByteBufferPool = connector.getRetainableByteBufferPool(); - return new SslConnection(retainableByteBufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()); + ByteBufferPool byteBufferPool = connector.getByteBufferPool(); + return new SslConnection(byteBufferPool, connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()); } @Override diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/BufferedResponseHandler.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/BufferedResponseHandler.java index 0f0dd3267fa6..9357b1a935f0 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/BufferedResponseHandler.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/BufferedResponseHandler.java @@ -21,8 +21,8 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.pathmap.PathSpecSet; import org.eclipse.jetty.io.ByteBufferAccumulator; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; @@ -189,7 +189,7 @@ public void write(boolean last, ByteBuffer byteBuffer, Callback callback) if (shouldBuffer(this, last)) { ConnectionMetaData connectionMetaData = getRequest().getConnectionMetaData(); - RetainableByteBufferPool bufferPool = connectionMetaData.getConnector().getRetainableByteBufferPool(); + ByteBufferPool bufferPool = connectionMetaData.getConnector().getByteBufferPool(); boolean useOutputDirectByteBuffers = connectionMetaData.getHttpConfiguration().isUseOutputDirectByteBuffers(); _accumulator = new CountingByteBufferAccumulator(bufferPool, useOutputDirectByteBuffers, getBufferSize()); } @@ -267,7 +267,7 @@ private static class CountingByteBufferAccumulator implements AutoCloseable private final int _maxSize; private int _accumulatedCount; - private CountingByteBufferAccumulator(RetainableByteBufferPool bufferPool, boolean direct, int maxSize) + private CountingByteBufferAccumulator(ByteBufferPool bufferPool, boolean direct, int maxSize) { if (maxSize <= 0) throw new IllegalArgumentException("maxSize must be > 0, was: " + maxSize); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java index a66b69b2c36f..7c207e2d583c 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ConnectHandler.java @@ -32,11 +32,11 @@ import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.ManagedSelector; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SocketChannelEndPoint; import org.eclipse.jetty.server.Handler; @@ -63,7 +63,7 @@ public class ConnectHandler extends Handler.Wrapper private final Set blackList = new HashSet<>(); private Executor executor; private Scheduler scheduler; - private RetainableByteBufferPool bufferPool; + private ByteBufferPool bufferPool; private SelectorManager selector; private long connectTimeout = 15000; private long idleTimeout = 30000; @@ -100,12 +100,12 @@ public void setScheduler(Scheduler scheduler) this.scheduler = scheduler; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } - public void setRetainableByteBufferPool(RetainableByteBufferPool bufferPool) + public void setByteBufferPool(ByteBufferPool bufferPool) { updateBean(this.bufferPool, bufferPool); this.bufferPool = bufferPool; @@ -167,7 +167,7 @@ protected void doStart() throws Exception if (bufferPool == null) { - bufferPool = getServer().getRetainableByteBufferPool(); + bufferPool = getServer().getByteBufferPool(); addBean(bufferPool); } @@ -382,12 +382,12 @@ protected boolean handleAuthentication(Request request, Response response, Strin protected DownstreamConnection newDownstreamConnection(EndPoint endPoint, ConcurrentMap context) { - return new DownstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), context); + return new DownstreamConnection(endPoint, getExecutor(), getByteBufferPool(), context); } protected UpstreamConnection newUpstreamConnection(EndPoint endPoint, ConnectContext connectContext) { - return new UpstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), connectContext); + return new UpstreamConnection(endPoint, getExecutor(), getByteBufferPool(), connectContext); } protected void prepareContext(Request request, ConcurrentMap context) @@ -553,7 +553,7 @@ public class UpstreamConnection extends TunnelConnection { private final ConnectContext connectContext; - public UpstreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, ConnectContext connectContext) + public UpstreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, ConnectContext connectContext) { super(endPoint, executor, bufferPool, connectContext.getContext()); this.connectContext = connectContext; @@ -589,7 +589,7 @@ public class DownstreamConnection extends TunnelConnection implements Connection { private ByteBuffer buffer; - public DownstreamConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, ConcurrentMap context) + public DownstreamConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, ConcurrentMap context) { super(endPoint, executor, bufferPool, context); } @@ -656,18 +656,18 @@ protected void write(EndPoint endPoint, ByteBuffer buffer, Callback callback) private abstract static class TunnelConnection extends AbstractConnection { private final IteratingCallback pipe = new ProxyIteratingCallback(); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final ConcurrentMap context; private TunnelConnection connection; - protected TunnelConnection(EndPoint endPoint, Executor executor, RetainableByteBufferPool bufferPool, ConcurrentMap context) + protected TunnelConnection(EndPoint endPoint, Executor executor, ByteBufferPool bufferPool, ConcurrentMap context) { super(endPoint, executor); this.bufferPool = bufferPool; this.context = context; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorProcessor.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorProcessor.java index 97aba33ae590..ad72cc0d63c8 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorProcessor.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorProcessor.java @@ -203,7 +203,7 @@ else if (charsets.contains(StandardCharsets.ISO_8859_1)) int bufferSize = request.getConnectionMetaData().getHttpConfiguration().getOutputBufferSize(); bufferSize = Math.min(8192, bufferSize); // TODO ? - RetainableByteBuffer buffer = request.getComponents().getRetainableByteBufferPool().acquire(bufferSize, false); + RetainableByteBuffer buffer = request.getComponents().getByteBufferPool().acquire(bufferSize, false); try { diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java index ba84e11e175d..472d092b6e1a 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java @@ -25,7 +25,7 @@ import org.eclipse.jetty.http.content.ResourceHttpContentFactory; import org.eclipse.jetty.http.content.ValidatingCachingHttpContentFactory; import org.eclipse.jetty.http.content.VirtualHttpContentFactory; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Context; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; @@ -57,7 +57,7 @@ public class ResourceHandler extends Handler.Wrapper { private final ResourceService _resourceService; - private RetainableByteBufferPool _bufferPool; + private ByteBufferPool _bufferPool; private Resource _resourceBase; private Resource _styleSheet; private MimeTypes _mimeTypes; @@ -80,21 +80,21 @@ public void doStart() throws Exception _mimeTypes = context == null ? MimeTypes.DEFAULTS : context.getMimeTypes(); - _bufferPool = getRetainableByteBufferPool(context); + _bufferPool = getByteBufferPool(context); _resourceService.setHttpContentFactory(newHttpContentFactory()); _resourceService.setWelcomeFactory(setupWelcomeFactory()); super.doStart(); } - private RetainableByteBufferPool getRetainableByteBufferPool(Context context) + private ByteBufferPool getByteBufferPool(Context context) { if (context == null) - return new RetainableByteBufferPool.NonPooling(); + return new ByteBufferPool.NonPooling(); Server server = getServer(); if (server == null) - return new RetainableByteBufferPool.NonPooling(); - return server.getRetainableByteBufferPool(); + return new ByteBufferPool.NonPooling(); + return server.getByteBufferPool(); } public HttpContent.Factory getHttpContentFactory() @@ -108,7 +108,7 @@ protected HttpContent.Factory newHttpContentFactory() contentFactory = new FileMappingHttpContentFactory(contentFactory); contentFactory = new VirtualHttpContentFactory(contentFactory, getStyleSheet(), "text/css"); contentFactory = new PreCompressedHttpContentFactory(contentFactory, getPrecompressedFormats()); - contentFactory = new ValidatingCachingHttpContentFactory(contentFactory, Duration.ofSeconds(1).toMillis(), getRetainableByteBufferPool()); + contentFactory = new ValidatingCachingHttpContentFactory(contentFactory, Duration.ofSeconds(1).toMillis(), getByteBufferPool()); return contentFactory; } @@ -159,7 +159,7 @@ public Resource getBaseResource() return _resourceBase; } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _bufferPool; } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipRequest.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipRequest.java index fecb4e308d9c..2915aa2cb8bc 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipRequest.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipRequest.java @@ -22,9 +22,9 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.PreEncodedHttpField; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.content.ContentSourceTransformer; import org.eclipse.jetty.server.Components; import org.eclipse.jetty.server.Request; @@ -50,7 +50,7 @@ public GzipRequest(Request request, int inflateBufferSize) if (inflateBufferSize > 0) { Components components = getComponents(); - _decoder = new Decoder(__inflaterPool, components.getRetainableByteBufferPool(), inflateBufferSize); + _decoder = new Decoder(__inflaterPool, components.getByteBufferPool(), inflateBufferSize); _gzipTransformer = new GzipTransformer(getWrapped()); } } @@ -192,7 +192,7 @@ private static class Decoder extends GZIPContentDecoder { private RetainableByteBuffer _decoded; - private Decoder(InflaterPool inflaterPool, RetainableByteBufferPool bufferPool, int bufferSize) + private Decoder(InflaterPool inflaterPool, ByteBufferPool bufferPool, int bufferSize) { super(inflaterPool, bufferPool, bufferSize); } diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipResponseAndCallback.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipResponseAndCallback.java index 7eb03b43e6d3..5ac6603d7064 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipResponseAndCallback.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipResponseAndCallback.java @@ -341,7 +341,7 @@ protected Action process() throws Exception // If we have no buffer if (_buffer == null) { - _buffer = getRequest().getComponents().getRetainableByteBufferPool().acquire(_bufferSize, false); + _buffer = getRequest().getComponents().getByteBufferPool().acquire(_bufferSize, false); ByteBuffer byteBuffer = _buffer.getByteBuffer(); // Per RFC-1952, GZIP is LITTLE_ENDIAN byteBuffer.order(ByteOrder.LITTLE_ENDIAN); diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java index 9779afe28cbd..05aad2237c49 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java @@ -37,10 +37,10 @@ import org.eclipse.jetty.http.PreEncodedHttpField; import org.eclipse.jetty.http.Trailers; import org.eclipse.jetty.http.UriCompliance; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Components; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Connector; @@ -221,9 +221,9 @@ public EndPoint getEndPoint() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return getConnectionMetaData().getConnector().getRetainableByteBufferPool(); + return getConnectionMetaData().getConnector().getByteBufferPool(); } @Override diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java index c5f3a5bba864..66a1220e86fa 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpConnection.java @@ -46,12 +46,12 @@ import org.eclipse.jetty.http.Trailers; import org.eclipse.jetty.http.UriCompliance; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.WriteFlusher; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.server.ConnectionFactory; @@ -95,7 +95,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Writ private final RequestHandler _requestHandler; private final HttpParser _parser; private final HttpGenerator _generator; - private final RetainableByteBufferPool _retainableByteBufferPool; + private final ByteBufferPool _retainableByteBufferPool; private final AtomicReference _stream = new AtomicReference<>(); private final Lazy _attributes = new Lazy(); private final DemandContentCallback _demandContentCallback = new DemandContentCallback(); @@ -139,7 +139,7 @@ public HttpConnection(HttpConfiguration configuration, Connector connector, EndP _id = __connectionIdGenerator.getAndIncrement(); _configuration = configuration; _connector = connector; - _retainableByteBufferPool = _connector.getRetainableByteBufferPool(); + _retainableByteBufferPool = _connector.getByteBufferPool(); _generator = newHttpGenerator(); _httpChannel = newHttpChannel(connector.getServer(), configuration); _requestHandler = newRequestHandler(); diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java index 706b07077ca9..2ee4ed232eb6 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java @@ -38,10 +38,10 @@ import org.eclipse.jetty.http.HttpTester; import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.logging.StacklessLogging; import org.eclipse.jetty.server.handler.EchoHandler; import org.eclipse.jetty.server.handler.HelloHandler; @@ -1766,7 +1766,7 @@ public void onClosed(Connection connection) long total = contents.stream().mapToLong(Content.Chunk::remaining).sum(); assertThat(total, equalTo(chunk.length * 4L)); - RetainableByteBufferPool rbbp = _connector.getRetainableByteBufferPool(); + ByteBufferPool rbbp = _connector.getByteBufferPool(); if (rbbp instanceof ArrayRetainableByteBufferPool pool) { long buffersBeforeRelease = pool.getAvailableDirectByteBufferCount() + pool.getAvailableHeapByteBufferCount(); diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java index 82134dd418d1..03ea64296e88 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/MockConnector.java @@ -15,13 +15,13 @@ import java.io.IOException; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; public class MockConnector extends AbstractConnector { public MockConnector(Server server) { - super(server, server.getThreadPool(), server.getScheduler(), new RetainableByteBufferPool.NonPooling(), 0); + super(server, server.getThreadPool(), server.getScheduler(), new ByteBufferPool.NonPooling(), 0); } @Override diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java index faf34e7da805..23a54bdfaf03 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java @@ -32,7 +32,7 @@ import javax.net.ssl.SSLContext; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IO; @@ -85,7 +85,7 @@ public static Stream scenarios() sslContextFactory.setKeyStorePassword("storepwd"); // TODO: restore leak tracking. // ByteBufferPool pool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged()); - RetainableByteBufferPool pool = new ArrayRetainableByteBufferPool(); + ByteBufferPool pool = new ArrayRetainableByteBufferPool(); HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(); ServerConnector connector = new ServerConnector(server, null, null, pool, acceptors, selectors, diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/DebugHandlerTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/DebugHandlerTest.java index 85ba710e331a..510a5aa5c9f4 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/DebugHandlerTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/DebugHandlerTest.java @@ -27,7 +27,7 @@ import javax.net.ssl.TrustManagerFactory; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.AbstractConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; @@ -72,7 +72,7 @@ public void startServer() throws Exception sslContextFactory.setKeyStorePassword("storepwd"); // TODO: restore leak tracking. // ByteBufferPool pool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged()); - RetainableByteBufferPool pool = new ArrayRetainableByteBufferPool(); + ByteBufferPool pool = new ArrayRetainableByteBufferPool(); ServerConnector sslConnector = new ServerConnector(server, null, null, pool, 1, 1, AbstractConnectionFactory.getFactories(sslContextFactory, new HttpConnectionFactory())); diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java index 6c8a49e6dd9a..6a8f2aac41f8 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java @@ -670,7 +670,7 @@ protected HttpContent.Factory newHttpContentFactory() contentFactory = new FileMappingHttpContentFactory(contentFactory); contentFactory = new VirtualHttpContentFactory(contentFactory, getStyleSheet(), "text/css"); contentFactory = new PreCompressedHttpContentFactory(contentFactory, getPrecompressedFormats()); - contentFactory = new ValidatingCachingHttpContentFactory(contentFactory, 0, getRetainableByteBufferPool()); + contentFactory = new ValidatingCachingHttpContentFactory(contentFactory, 0, getByteBufferPool()); return contentFactory; } }; diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java index 9690f293b681..757bd6760e3e 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLEngineTest.java @@ -203,7 +203,7 @@ public void testInvalidLargeTLSFrame() throws Exception @Override protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine) { - return new SslConnection(connector.getRetainableByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) + return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine, isDirectBuffersForEncryption(), isDirectBuffersForDecryption()) { @Override protected SSLEngineResult unwrap(SSLEngine sslEngine, ByteBuffer input, ByteBuffer output) throws SSLException diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/ServerConnectorSslServerTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/ServerConnectorSslServerTest.java index aff49dfb563d..9bfc7c12b1d7 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/ServerConnectorSslServerTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/ServerConnectorSslServerTest.java @@ -28,8 +28,8 @@ import javax.net.ssl.TrustManagerFactory; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.AbstractConnectionFactory; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -75,7 +75,7 @@ public void init() throws Exception sslContextFactory.setKeyStorePassword("storepwd"); // TODO: restore leak tracking. // ByteBufferPool pool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged()); - RetainableByteBufferPool pool = new ArrayRetainableByteBufferPool(); + ByteBufferPool pool = new ArrayRetainableByteBufferPool(); HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(); ServerConnector connector = new ServerConnector(_server, null, null, pool, 1, 1, AbstractConnectionFactory.getFactories(sslContextFactory, httpConnectionFactory)); diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/ForwardProxyWithDynamicTransportTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/ForwardProxyWithDynamicTransportTest.java index 5d30ae9c4039..0105801ad25e 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/ForwardProxyWithDynamicTransportTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/ForwardProxyWithDynamicTransportTest.java @@ -411,7 +411,7 @@ public void testHTTP2TunnelResetByClient() throws Exception @Override protected DownstreamConnection newDownstreamConnection(EndPoint endPoint, ConcurrentMap context) { - return new DownstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), context) + return new DownstreamConnection(endPoint, getExecutor(), getByteBufferPool(), context) { @Override protected void close(Throwable failure) @@ -425,7 +425,7 @@ protected void close(Throwable failure) @Override protected UpstreamConnection newUpstreamConnection(EndPoint endPoint, ConnectContext connectContext) { - return new UpstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), connectContext) + return new UpstreamConnection(endPoint, getExecutor(), getByteBufferPool(), connectContext) { @Override protected void close(Throwable failure) @@ -494,7 +494,7 @@ public void testHTTP2TunnelProxyStreamTimeout() throws Exception @Override protected DownstreamConnection newDownstreamConnection(EndPoint endPoint, ConcurrentMap context) { - return new DownstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), context) + return new DownstreamConnection(endPoint, getExecutor(), getByteBufferPool(), context) { @Override protected void close(Throwable failure) @@ -508,7 +508,7 @@ protected void close(Throwable failure) @Override protected UpstreamConnection newUpstreamConnection(EndPoint endPoint, ConnectContext connectContext) { - return new UpstreamConnection(endPoint, getExecutor(), getRetainableByteBufferPool(), connectContext) + return new UpstreamConnection(endPoint, getExecutor(), getByteBufferPool(), connectContext) { @Override protected void close(Throwable failure) diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientDemandTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientDemandTest.java index d03171b4af61..d02f661b0d26 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientDemandTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientDemandTest.java @@ -140,7 +140,7 @@ public boolean process(Request request, org.eclipse.jetty.server.Response respon }); startClient(transport); client.stop(); - client.setRetainableByteBufferPool(new ArrayRetainableByteBufferPool(0, bufferSize, -1)); + client.setByteBufferPool(new ArrayRetainableByteBufferPool(0, bufferSize, -1)); client.setResponseBufferSize(bufferSize); client.start(); @@ -322,7 +322,7 @@ public boolean process(Request request, org.eclipse.jetty.server.Response respon }); startClient(transport); client.stop(); - client.setRetainableByteBufferPool(new ArrayRetainableByteBufferPool(0, bufferSize, -1)); + client.setByteBufferPool(new ArrayRetainableByteBufferPool(0, bufferSize, -1)); client.setResponseBufferSize(bufferSize); client.start(); diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientLoadTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientLoadTest.java index 6c079f2014e5..6fbc196f92a2 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientLoadTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientLoadTest.java @@ -68,7 +68,7 @@ public void testIterative(Transport transport) throws Exception setStreamIdleTimeout(120000); client.stop(); // TODO: restore leak tracking. - client.setRetainableByteBufferPool(new ArrayRetainableByteBufferPool()); + client.setByteBufferPool(new ArrayRetainableByteBufferPool()); client.setMaxConnectionsPerDestination(32768); client.setMaxRequestsQueuedPerDestination(1024 * 1024); client.setIdleTimeout(120000); @@ -118,7 +118,7 @@ public void testConcurrent(Transport transport) throws Exception start(transport, new LoadHandler()); client.stop(); // TODO: restore leak tracking. - client.setRetainableByteBufferPool(new ArrayRetainableByteBufferPool()); + client.setByteBufferPool(new ArrayRetainableByteBufferPool()); client.setMaxConnectionsPerDestination(32768); client.setMaxRequestsQueuedPerDestination(1024 * 1024); client.start(); diff --git a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientTimeoutTest.java b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientTimeoutTest.java index f8461a52f26c..7b55d8310dc7 100644 --- a/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientTimeoutTest.java +++ b/jetty-core/jetty-tests/jetty-test-client-transports/src/test/java/org/eclipse/jetty/test/client/transport/HttpClientTimeoutTest.java @@ -35,10 +35,10 @@ import org.eclipse.jetty.client.Response; import org.eclipse.jetty.client.Result; import org.eclipse.jetty.http.HttpStatus; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; import org.eclipse.jetty.io.ssl.SslConnection; import org.eclipse.jetty.server.Handler; @@ -238,10 +238,10 @@ public ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory.C { if (sslContextFactory == null) sslContextFactory = getSslContextFactory(); - return new SslClientConnectionFactory(sslContextFactory, getRetainableByteBufferPool(), getExecutor(), connectionFactory) + return new SslClientConnectionFactory(sslContextFactory, getByteBufferPool(), getExecutor(), connectionFactory) { @Override - protected SslConnection newSslConnection(RetainableByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) + protected SslConnection newSslConnection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, SSLEngine engine) { return new SslConnection(bufferPool, executor, endPoint, engine) { diff --git a/jetty-core/jetty-unixdomain-server/src/main/java/org/eclipse/jetty/unixdomain/server/UnixDomainServerConnector.java b/jetty-core/jetty-unixdomain-server/src/main/java/org/eclipse/jetty/unixdomain/server/UnixDomainServerConnector.java index b29dade57a05..8ec741d8db13 100644 --- a/jetty-core/jetty-unixdomain-server/src/main/java/org/eclipse/jetty/unixdomain/server/UnixDomainServerConnector.java +++ b/jetty-core/jetty-unixdomain-server/src/main/java/org/eclipse/jetty/unixdomain/server/UnixDomainServerConnector.java @@ -29,10 +29,10 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.ManagedSelector; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SocketChannelEndPoint; import org.eclipse.jetty.server.AbstractConnector; @@ -78,7 +78,7 @@ public UnixDomainServerConnector(Server server, int acceptors, int selectors, Co this(server, null, null, null, acceptors, selectors, factories); } - public UnixDomainServerConnector(Server server, Executor executor, Scheduler scheduler, RetainableByteBufferPool bufferPool, int acceptors, int selectors, ConnectionFactory... factories) + public UnixDomainServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, int selectors, ConnectionFactory... factories) { super(server, executor, scheduler, bufferPool, acceptors, factories.length > 0 ? factories : new ConnectionFactory[]{new HttpConnectionFactory()}); selectorManager = newSelectorManager(getExecutor(), getScheduler(), selectors); diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java index 7502e987b5be..dcd32bfeb977 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ReservedThreadExecutor.java @@ -40,7 +40,6 @@ import static org.eclipse.jetty.util.AtomicBiInteger.getHi; import static org.eclipse.jetty.util.AtomicBiInteger.getLo; - /** *

    A TryExecutor using pre-allocated/reserved threads from an external Executor.

    *

    Calls to {@link #tryExecute(Runnable)} on ReservedThreadExecutor will either @@ -440,4 +439,4 @@ public String toString() _thread); } } -} \ No newline at end of file +} diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-client/src/main/java/org/eclipse/jetty/websocket/core/client/CoreClientUpgradeRequest.java b/jetty-core/jetty-websocket/jetty-websocket-core-client/src/main/java/org/eclipse/jetty/websocket/core/client/CoreClientUpgradeRequest.java index b91222f4f784..e53481e36e7c 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-client/src/main/java/org/eclipse/jetty/websocket/core/client/CoreClientUpgradeRequest.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-client/src/main/java/org/eclipse/jetty/websocket/core/client/CoreClientUpgradeRequest.java @@ -37,8 +37,8 @@ import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.ExceptionUtil; import org.eclipse.jetty.util.QuotedStringTokenizer; @@ -477,7 +477,7 @@ else if (values.length == 1) customizer.customize(coreSession); HttpClient httpClient = wsClient.getHttpClient(); - RetainableByteBufferPool bufferPool = wsClient.getWebSocketComponents().getRetainableByteBufferPool(); + ByteBufferPool bufferPool = wsClient.getWebSocketComponents().getByteBufferPool(); WebSocketConnection wsConnection = new WebSocketConnection(endPoint, httpClient.getExecutor(), httpClient.getScheduler(), bufferPool, coreSession); wsClient.getEventListeners().forEach(wsConnection::addEventListener); coreSession.setWebSocketConnection(wsConnection); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java index c9697965d12f..1bc75708dcc5 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java @@ -13,7 +13,7 @@ package org.eclipse.jetty.websocket.core; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @@ -27,7 +27,7 @@ public class AbstractExtension implements Extension { private final Logger log; private CoreSession coreSession; - private RetainableByteBufferPool bufferPool; + private ByteBufferPool bufferPool; private ExtensionConfig config; private OutgoingFrames nextOutgoing; private IncomingFrames nextIncoming; @@ -43,7 +43,7 @@ public AbstractExtension() public void init(ExtensionConfig config, WebSocketComponents components) { this.config = config; - this.bufferPool = components.getRetainableByteBufferPool(); + this.bufferPool = components.getByteBufferPool(); this.deflaterPool = components.getDeflaterPool(); this.inflaterPool = components.getInflaterPool(); } @@ -60,7 +60,7 @@ public void sendFrame(Frame frame, Callback callback, boolean batch) nextOutgoingFrame(frame, callback, batch); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java index 37f72f2dedc6..0fb82bef2eab 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.Map; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; /** @@ -82,9 +82,9 @@ public interface CoreSession extends OutgoingFrames, Configuration WebSocketComponents getWebSocketComponents(); /** - * @return The shared RetainableByteBufferPool + * @return The shared ByteBufferPool */ - RetainableByteBufferPool getRetainableByteBufferPool(); + ByteBufferPool getByteBufferPool(); /** * The Local Socket Address for the connection @@ -241,7 +241,7 @@ public WebSocketComponents getWebSocketComponents() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return null; } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java index d32f59a7d6b0..b1ec7823a793 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java @@ -17,7 +17,7 @@ import java.util.zip.Deflater; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.compression.CompressionPool; @@ -27,14 +27,14 @@ /** * A collection of components which are the resources needed for websockets such as - * {@link RetainableByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}. + * {@link ByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}. */ public class WebSocketComponents extends ContainerLifeCycle { private final DecoratedObjectFactory _objectFactory; private final WebSocketExtensionRegistry _extensionRegistry; private final Executor _executor; - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private final InflaterPool _inflaterPool; private final DeflaterPool _deflaterPool; @@ -44,13 +44,13 @@ public WebSocketComponents() } public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, DecoratedObjectFactory objectFactory, - RetainableByteBufferPool bufferPool, InflaterPool inflaterPool, DeflaterPool deflaterPool) + ByteBufferPool bufferPool, InflaterPool inflaterPool, DeflaterPool deflaterPool) { this (extensionRegistry, objectFactory, bufferPool, inflaterPool, deflaterPool, null); } public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, DecoratedObjectFactory objectFactory, - RetainableByteBufferPool bufferPool, InflaterPool inflaterPool, DeflaterPool deflaterPool, Executor executor) + ByteBufferPool bufferPool, InflaterPool inflaterPool, DeflaterPool deflaterPool, Executor executor) { _extensionRegistry = (extensionRegistry == null) ? new WebSocketExtensionRegistry() : extensionRegistry; _objectFactory = (objectFactory == null) ? new DecoratedObjectFactory() : objectFactory; @@ -77,7 +77,7 @@ public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, Decorat addBean(_executor); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return _bufferPool; } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java index f91ec562258f..8ef51830e5a2 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameCaptureExtension.java @@ -106,7 +106,7 @@ private void saveFrame(Frame frame, boolean outgoing) return; } - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(BUFSIZE, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(BUFSIZE, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); try { diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java index 4c63f0853af3..c5af18aba972 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java @@ -24,9 +24,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.LongAdder; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingCallback; @@ -51,7 +51,7 @@ public class FrameFlusher extends IteratingCallback private final AutoLock lock = new AutoLock(); private final LongAdder messagesOut = new LongAdder(); private final LongAdder bytesOut = new LongAdder(); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final EndPoint endPoint; private final int bufferSize; private final Generator generator; @@ -71,7 +71,7 @@ public class FrameFlusher extends IteratingCallback private long idleTimeout; private boolean useDirectByteBuffers; - public FrameFlusher(RetainableByteBufferPool 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) { this.bufferPool = bufferPool; this.endPoint = endPoint; diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java index a1654ff7c84e..4b30f4af6790 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java @@ -16,8 +16,8 @@ import java.io.Closeable; import java.nio.ByteBuffer; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.websocket.core.CloseStatus; @@ -48,7 +48,7 @@ private enum State private static final Logger LOG = LoggerFactory.getLogger(Parser.class); - private final RetainableByteBufferPool bufferPool; + private final ByteBufferPool bufferPool; private final Configuration configuration; // State specific @@ -59,12 +59,12 @@ private enum State private int payloadLength; private RetainableByteBuffer aggregate; - public Parser(RetainableByteBufferPool bufferPool) + public Parser(ByteBufferPool bufferPool) { this(bufferPool, new Configuration.ConfigurationCustomizer()); } - public Parser(RetainableByteBufferPool bufferPool, Configuration configuration) + public Parser(ByteBufferPool bufferPool, Configuration configuration) { this.bufferPool = bufferPool; this.configuration = configuration; diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java index c175ea4b668e..7628aabe153a 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java @@ -298,7 +298,7 @@ private boolean deflate(Callback callback) // Get a buffer for the deflated payload. long maxFrameSize = getConfiguration().getMaxFrameSize(); int bufferSize = (maxFrameSize <= 0) ? deflateBufferSize : (int)Math.min(maxFrameSize, deflateBufferSize); - RetainableByteBuffer buffer = getRetainableByteBufferPool().acquire(bufferSize, false); + RetainableByteBuffer buffer = getByteBufferPool().acquire(bufferSize, false); ByteBuffer byteBuffer = buffer.getByteBuffer(); callback = Callback.from(callback, buffer::release); buffer.clear(); @@ -425,7 +425,7 @@ private boolean inflate(Frame frame, Callback callback, boolean first) throws Da // Get a buffer for the inflated payload. long maxFrameSize = getConfiguration().getMaxFrameSize(); int bufferSize = (maxFrameSize <= 0) ? inflateBufferSize : (int)Math.min(maxFrameSize, inflateBufferSize); - RetainableByteBuffer payload = getRetainableByteBufferPool().acquire(bufferSize, false); + RetainableByteBuffer payload = getByteBufferPool().acquire(bufferSize, false); _payloadRef = new AtomicReference<>(payload); ByteBuffer byteBuffer = payload.getByteBuffer(); payload.clear(); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java index 896142046d67..a7b25cfd7b26 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java @@ -24,10 +24,10 @@ import java.util.concurrent.atomic.LongAdder; import org.eclipse.jetty.io.AbstractConnection; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.MathUtils; @@ -53,7 +53,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio private static final int MIN_BUFFER_SIZE = Generator.MAX_HEADER_LENGTH; private final AutoLock lock = new AutoLock(); - private final RetainableByteBufferPool retainableByteBufferPool; + private final ByteBufferPool byteBufferPool; private final Generator generator; private final Parser parser; private final WebSocketCoreSession coreSession; @@ -78,10 +78,10 @@ public class WebSocketConnection extends AbstractConnection implements Connectio public WebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, - RetainableByteBufferPool retainableByteBufferPool, + ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) { - this(endp, executor, scheduler, retainableByteBufferPool, coreSession, null); + this(endp, executor, scheduler, byteBufferPool, coreSession, null); } /** @@ -93,14 +93,14 @@ public WebSocketConnection(EndPoint endp, * @param endp The endpoint ever which Websockot is sent/received * @param executor A thread executor to use for WS callbacks. * @param scheduler A scheduler to use for timeouts - * @param retainableByteBufferPool A pool of retainable buffers to use. + * @param byteBufferPool A pool of retainable buffers to use. * @param coreSession The WC core session to which frames are delivered. * @param randomMask A Random used to mask frames. If null then SecureRandom will be created if needed. */ public WebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, - RetainableByteBufferPool retainableByteBufferPool, + ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession, Random randomMask) { @@ -109,12 +109,12 @@ public WebSocketConnection(EndPoint endp, Objects.requireNonNull(endp, "EndPoint"); Objects.requireNonNull(coreSession, "Session"); Objects.requireNonNull(executor, "Executor"); - Objects.requireNonNull(retainableByteBufferPool, "RetainableByteBufferPool"); + Objects.requireNonNull(byteBufferPool, "ByteBufferPool"); - this.retainableByteBufferPool = retainableByteBufferPool; + this.byteBufferPool = byteBufferPool; this.coreSession = coreSession; this.generator = new Generator(); - this.parser = new Parser(retainableByteBufferPool, coreSession); + this.parser = new Parser(byteBufferPool, coreSession); this.flusher = new Flusher(scheduler, coreSession.getOutputBufferSize(), generator, endp); this.setInputBufferSize(coreSession.getInputBufferSize()); @@ -303,7 +303,7 @@ private void reacquireNetworkBuffer() private RetainableByteBuffer newNetworkBuffer(int capacity) { - return retainableByteBufferPool.acquire(capacity, isUseInputDirectByteBuffers()); + return byteBufferPool.acquire(capacity, isUseInputDirectByteBuffers()); } private void releaseNetworkBuffer() @@ -626,7 +626,7 @@ private class Flusher extends FrameFlusher { private Flusher(Scheduler scheduler, int bufferSize, Generator generator, EndPoint endpoint) { - super(retainableByteBufferPool, scheduler, generator, endpoint, bufferSize, 8); + super(byteBufferPool, scheduler, generator, endpoint, bufferSize, 8); setUseDirectByteBuffers(isUseOutputDirectByteBuffers()); } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java index 3a3aa7121e23..ac2ea5f6f8a3 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicInteger; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Utf8Appendable; import org.eclipse.jetty.util.component.Dumpable; @@ -240,9 +240,9 @@ private void close(CloseStatus closeStatus, Callback callback) } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return components.getRetainableByteBufferPool(); + return components.getByteBufferPool(); } public void onEof() diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/ByteBufferMessageSink.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/ByteBufferMessageSink.java index a3b945494c0f..4f898a3e50c2 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/ByteBufferMessageSink.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/ByteBufferMessageSink.java @@ -19,8 +19,8 @@ import java.util.Objects; import org.eclipse.jetty.io.ByteBufferCallbackAccumulator; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CoreSession; @@ -84,7 +84,7 @@ public void accept(Frame frame, Callback callback) callback = Callback.NOOP; if (frame.isFin()) { - RetainableByteBufferPool bufferPool = session.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = session.getByteBufferPool(); RetainableByteBuffer buffer = bufferPool.acquire(out.getLength(), false); ByteBuffer byteBuffer = buffer.getByteBuffer(); out.writeTo(byteBuffer); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageOutputStream.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageOutputStream.java index 2d17db34e70c..f5823a418d30 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageOutputStream.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageOutputStream.java @@ -17,8 +17,8 @@ import java.io.OutputStream; import java.nio.ByteBuffer; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; @@ -46,7 +46,7 @@ public class MessageOutputStream extends OutputStream private boolean closed; private byte messageOpCode = OpCode.BINARY; - public MessageOutputStream(CoreSession coreSession, RetainableByteBufferPool bufferPool) + public MessageOutputStream(CoreSession coreSession, ByteBufferPool bufferPool) { this.coreSession = coreSession; this.bufferSize = coreSession.getOutputBufferSize(); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageWriter.java b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageWriter.java index 952b28c948b3..0220d5b2711e 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageWriter.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/internal/messages/MessageWriter.java @@ -19,7 +19,7 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.CodingErrorAction; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.OpCode; @@ -38,7 +38,7 @@ public class MessageWriter extends Writer .onUnmappableCharacter(CodingErrorAction.REPORT) .onMalformedInput(CodingErrorAction.REPORT); - public MessageWriter(CoreSession coreSession, RetainableByteBufferPool bufferPool) + public MessageWriter(CoreSession coreSession, ByteBufferPool bufferPool) { this.outputStream = new MessageOutputStream(coreSession, bufferPool); this.outputStream.setMessageType(OpCode.TEXT); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java index d3ec78cfd922..0c8e31b32d46 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketServerComponents.java @@ -15,7 +15,7 @@ import java.util.concurrent.Executor; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.DecoratedObjectFactory; @@ -27,7 +27,7 @@ /** * A collection of components which are the resources needed for websockets such as - * {@link RetainableByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}. + * {@link ByteBufferPool}, {@link WebSocketExtensionRegistry}, and {@link DecoratedObjectFactory}. * * These components should be accessed through {@link WebSocketServerComponents#getWebSocketComponents} so that * the instance can be shared by being stored as a bean on the ContextHandler. @@ -39,7 +39,7 @@ public class WebSocketServerComponents extends WebSocketComponents public static final String WEBSOCKET_DEFLATER_POOL_ATTRIBUTE = "jetty.websocket.deflater"; public static final String WEBSOCKET_BUFFER_POOL_ATTRIBUTE = "jetty.websocket.bufferPool"; - WebSocketServerComponents(InflaterPool inflaterPool, DeflaterPool deflaterPool, RetainableByteBufferPool bufferPool, DecoratedObjectFactory objectFactory, Executor executor) + WebSocketServerComponents(InflaterPool inflaterPool, DeflaterPool deflaterPool, ByteBufferPool bufferPool, DecoratedObjectFactory objectFactory, Executor executor) { super(null, objectFactory, bufferPool, inflaterPool, deflaterPool, executor); } @@ -53,7 +53,7 @@ public class WebSocketServerComponents extends WebSocketComponents *

    *

    * Servlet context attributes can be set with {@link #WEBSOCKET_BUFFER_POOL_ATTRIBUTE}, {@link #WEBSOCKET_INFLATER_POOL_ATTRIBUTE} - * and {@link #WEBSOCKET_DEFLATER_POOL_ATTRIBUTE} to override the {@link RetainableByteBufferPool}, {@link DeflaterPool} or + * and {@link #WEBSOCKET_DEFLATER_POOL_ATTRIBUTE} to override the {@link ByteBufferPool}, {@link DeflaterPool} or * {@link InflaterPool} used by the components, otherwise this will try to use the pools shared on the {@link Server}. *

    * @param server the server. @@ -75,9 +75,9 @@ public static WebSocketComponents ensureWebSocketComponents(Server server, Conte if (deflaterPool == null) deflaterPool = DeflaterPool.ensurePool(server); - RetainableByteBufferPool bufferPool = (RetainableByteBufferPool)context.getAttribute(WEBSOCKET_BUFFER_POOL_ATTRIBUTE); + ByteBufferPool bufferPool = (ByteBufferPool)context.getAttribute(WEBSOCKET_BUFFER_POOL_ATTRIBUTE); if (bufferPool == null) - bufferPool = server.getRetainableByteBufferPool(); + bufferPool = server.getByteBufferPool(); Executor executor = (Executor)context.getAttribute("org.eclipse.jetty.server.Executor"); if (executor == null) diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java index 6c6fac9d3c78..8735d8d4e5ec 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java @@ -20,8 +20,8 @@ import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.PreEncodedHttpField; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Context; import org.eclipse.jetty.server.HttpConfiguration; @@ -188,9 +188,9 @@ protected void handle(Runnable runnable) protected abstract WebSocketConnection createWebSocketConnection(Request baseRequest, WebSocketCoreSession coreSession); - protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, RetainableByteBufferPool retainableByteBufferPool, WebSocketCoreSession coreSession) + protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) { - return new WebSocketConnection(endPoint, executor, scheduler, retainableByteBufferPool, coreSession); + return new WebSocketConnection(endPoint, executor, scheduler, byteBufferPool, coreSession); } protected abstract void prepareResponse(Response response, WebSocketNegotiation negotiation); diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java index 6b6760641299..eb7c09b1e03f 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java @@ -21,7 +21,7 @@ import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.PreEncodedHttpField; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; @@ -79,8 +79,8 @@ protected WebSocketConnection createWebSocketConnection(Request baseRequest, Web { ConnectionMetaData connectionMetaData = baseRequest.getConnectionMetaData(); Connector connector = connectionMetaData.getConnector(); - RetainableByteBufferPool retainableByteBufferPool = connector.getRetainableByteBufferPool(); - return newWebSocketConnection(connectionMetaData.getConnection().getEndPoint(), connector.getExecutor(), connector.getScheduler(), retainableByteBufferPool, coreSession); + ByteBufferPool byteBufferPool = connector.getByteBufferPool(); + return newWebSocketConnection(connectionMetaData.getConnection().getEndPoint(), connector.getExecutor(), connector.getScheduler(), byteBufferPool, coreSession); } @Override diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java index b838f05a939d..365ac518a4ec 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC8441Handshaker.java @@ -16,8 +16,8 @@ import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Response; @@ -59,10 +59,10 @@ protected WebSocketNegotiation newNegotiation(Request request, Response response protected WebSocketConnection createWebSocketConnection(Request request, WebSocketCoreSession coreSession) { Connector connector = request.getConnectionMetaData().getConnector(); - RetainableByteBufferPool retainableByteBufferPool = connector.getRetainableByteBufferPool(); + ByteBufferPool byteBufferPool = connector.getByteBufferPool(); TunnelSupport tunnelSupport = request.getTunnelSupport(); EndPoint endPoint = tunnelSupport.getEndPoint(); - return newWebSocketConnection(endPoint, connector.getExecutor(), connector.getScheduler(), retainableByteBufferPool, coreSession); + return newWebSocketConnection(endPoint, connector.getExecutor(), connector.getScheduler(), byteBufferPool, coreSession); } @Override diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java index 725551fd793c..d0e7a998f9fe 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundTripTest.java @@ -18,8 +18,8 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.websocket.core.internal.Generator; import org.junit.jupiter.api.Test; @@ -29,7 +29,7 @@ public class GeneratorParserRoundTripTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testParserAndGenerator() throws Exception diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java index 04875c98dc06..19083cf8f9c1 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java @@ -20,7 +20,7 @@ import java.util.concurrent.ExecutionException; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; @@ -61,7 +61,7 @@ public void beforeEach() throws Exception coreSession = new CoreSession.Empty() { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Override public void sendFrame(Frame frame, Callback callback, boolean batch) @@ -71,7 +71,7 @@ public void sendFrame(Frame frame, Callback callback, boolean batch) } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java index ac53eedd30f8..d6c6cadae6b9 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java @@ -55,7 +55,7 @@ public ParserCapture(boolean copy, Behavior behavior) this.coreSession = new WebSocketCoreSession(new TestMessageHandler(), behavior, Negotiated.from(exStack), components); coreSession.setAutoFragment(false); coreSession.setMaxFrameSize(0); - this.parser = new Parser(components.getRetainableByteBufferPool(), coreSession); + this.parser = new Parser(components.getByteBufferPool(), coreSession); } public void parse(ByteBuffer buffer) diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java index 692cec81bd31..4010a1a4e958 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/WebSocketTester.java @@ -25,8 +25,8 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.websocket.core.internal.Parser; @@ -42,7 +42,7 @@ public class WebSocketTester { private static final String NON_RANDOM_KEY = Base64.getEncoder().encodeToString("0123456701234567".getBytes()); private static SslContextFactory.Client sslContextFactory; - protected RetainableByteBufferPool bufferPool; + protected ByteBufferPool bufferPool; protected RetainableByteBuffer buffer; protected Parser parser; diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java index 321d6cc78eff..fddcb5e8399a 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java @@ -27,7 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler; @@ -52,7 +52,7 @@ public class FrameFlusherTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); private Scheduler scheduler; @BeforeEach @@ -231,7 +231,7 @@ public static class CapturingEndPoint extends MockEndpoint public Parser parser; public LinkedBlockingQueue incomingFrames = new LinkedBlockingQueue<>(); - public CapturingEndPoint(RetainableByteBufferPool bufferPool) + public CapturingEndPoint(ByteBufferPool bufferPool) { parser = new Parser(bufferPool); } @@ -282,7 +282,7 @@ public void setBlockTime(int time) blockTime = time; } - public BlockingEndpoint(RetainableByteBufferPool bufferPool) + public BlockingEndpoint(ByteBufferPool bufferPool) { super(bufferPool); } diff --git a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/util/MessageWriterTest.java b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/util/MessageWriterTest.java index ca25168bef08..efd67814b72b 100644 --- a/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/util/MessageWriterTest.java +++ b/jetty-core/jetty-websocket/jetty-websocket-core-tests/src/test/java/org/eclipse/jetty/websocket/core/util/MessageWriterTest.java @@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.websocket.core.CoreSession; @@ -37,7 +37,7 @@ public class MessageWriterTest { private final CoreSession coreSession = new CoreSession.Empty(); - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testMultipleWrites() throws Exception diff --git a/jetty-ee10/jetty-ee10-annotations/src/test/java/org/eclipse/jetty/ee10/annotations/TestAnnotationParser.java b/jetty-ee10/jetty-ee10-annotations/src/test/java/org/eclipse/jetty/ee10/annotations/TestAnnotationParser.java index 347ce318fa48..e7872f38c704 100644 --- a/jetty-ee10/jetty-ee10-annotations/src/test/java/org/eclipse/jetty/ee10/annotations/TestAnnotationParser.java +++ b/jetty-ee10/jetty-ee10-annotations/src/test/java/org/eclipse/jetty/ee10/annotations/TestAnnotationParser.java @@ -47,7 +47,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @ExtendWith(WorkDirExtension.class) diff --git a/jetty-ee10/jetty-ee10-maven-plugin/src/main/java/org/eclipse/jetty/ee10/maven/plugin/MavenServerConnector.java b/jetty-ee10/jetty-ee10-maven-plugin/src/main/java/org/eclipse/jetty/ee10/maven/plugin/MavenServerConnector.java index 2e24e306c50b..ac35c0577f27 100644 --- a/jetty-ee10/jetty-ee10-maven-plugin/src/main/java/org/eclipse/jetty/ee10/maven/plugin/MavenServerConnector.java +++ b/jetty-ee10/jetty-ee10-maven-plugin/src/main/java/org/eclipse/jetty/ee10/maven/plugin/MavenServerConnector.java @@ -18,8 +18,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -146,9 +146,9 @@ public Scheduler getScheduler() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return checkDelegate().getRetainableByteBufferPool(); + return checkDelegate().getByteBufferPool(); } @Override diff --git a/jetty-ee10/jetty-ee10-osgi/test-jetty-ee10-osgi/src/test/java/org/eclipse/jetty/ee10/osgi/test/TestJettyOSGiAnnotationParser.java b/jetty-ee10/jetty-ee10-osgi/test-jetty-ee10-osgi/src/test/java/org/eclipse/jetty/ee10/osgi/test/TestJettyOSGiAnnotationParser.java index 97f807d2feff..63b1780c8cfc 100644 --- a/jetty-ee10/jetty-ee10-osgi/test-jetty-ee10-osgi/src/test/java/org/eclipse/jetty/ee10/osgi/test/TestJettyOSGiAnnotationParser.java +++ b/jetty-ee10/jetty-ee10-osgi/test-jetty-ee10-osgi/src/test/java/org/eclipse/jetty/ee10/osgi/test/TestJettyOSGiAnnotationParser.java @@ -41,7 +41,6 @@ import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; - /** * TestJettyOSGiAnnotationParser * diff --git a/jetty-ee10/jetty-ee10-proxy/src/main/java/org/eclipse/jetty/ee10/proxy/AsyncMiddleManServlet.java b/jetty-ee10/jetty-ee10-proxy/src/main/java/org/eclipse/jetty/ee10/proxy/AsyncMiddleManServlet.java index 1adcff3860d2..7b6434c78191 100644 --- a/jetty-ee10/jetty-ee10-proxy/src/main/java/org/eclipse/jetty/ee10/proxy/AsyncMiddleManServlet.java +++ b/jetty-ee10/jetty-ee10-proxy/src/main/java/org/eclipse/jetty/ee10/proxy/AsyncMiddleManServlet.java @@ -43,9 +43,9 @@ import org.eclipse.jetty.client.Response; import org.eclipse.jetty.client.Result; import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.server.handler.ConnectHandler; import org.eclipse.jetty.util.BufferUtil; @@ -775,7 +775,7 @@ public GZIPContentTransformer(HttpClient httpClient, ContentTransformer transfor try { this.transformer = transformer; - RetainableByteBufferPool bufferPool = httpClient == null ? null : httpClient.getRetainableByteBufferPool(); + ByteBufferPool bufferPool = httpClient == null ? null : httpClient.getByteBufferPool(); this.decoder = new GZIPContentDecoder(bufferPool, GZIPContentDecoder.DEFAULT_BUFFER_SIZE); this.out = new ByteArrayOutputStream(); this.gzipOut = new GZIPOutputStream(out); diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/DefaultServlet.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/DefaultServlet.java index 114dd6aba079..b567bb8fcb9d 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/DefaultServlet.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/DefaultServlet.java @@ -60,7 +60,7 @@ import org.eclipse.jetty.http.content.ValidatingCachingHttpContentFactory; import org.eclipse.jetty.http.content.VirtualHttpContentFactory; import org.eclipse.jetty.io.ByteBufferInputStream; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Context; import org.eclipse.jetty.server.HttpStream; import org.eclipse.jetty.server.Request; @@ -167,7 +167,7 @@ public void init() throws ServletException long cacheValidationTime = getInitParameter("cacheValidationTime") != null ? Long.parseLong(getInitParameter("cacheValidationTime")) : -2; if (maxCachedFiles != -2 || maxCacheSize != -2 || maxCachedFileSize != -2 || cacheValidationTime != -2) { - RetainableByteBufferPool bufferPool = getRetainableByteBufferPool(servletContextHandler); + ByteBufferPool bufferPool = getByteBufferPool(servletContextHandler); ValidatingCachingHttpContentFactory cached = new ValidatingCachingHttpContentFactory(contentFactory, (cacheValidationTime > -2) ? cacheValidationTime : Duration.ofSeconds(1).toMillis(), bufferPool); contentFactory = cached; @@ -238,14 +238,14 @@ public void init() throws ServletException } } - private static RetainableByteBufferPool getRetainableByteBufferPool(ContextHandler contextHandler) + private static ByteBufferPool getByteBufferPool(ContextHandler contextHandler) { if (contextHandler == null) - return new RetainableByteBufferPool.NonPooling(); + return new ByteBufferPool.NonPooling(); Server server = contextHandler.getServer(); if (server == null) - return new RetainableByteBufferPool.NonPooling(); - return server.getRetainableByteBufferPool(); + return new ByteBufferPool.NonPooling(); + return server.getByteBufferPool(); } private String getInitParameter(String name, String... deprecated) diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/HttpOutput.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/HttpOutput.java index c039c45d1caf..6954fd836be5 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/HttpOutput.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/HttpOutput.java @@ -31,10 +31,10 @@ import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletResponse; import jakarta.servlet.WriteListener; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.Response; @@ -130,7 +130,7 @@ enum ApiState private final ConnectionMetaData _connectionMetaData; private final ServletChannel _servletChannel; private final Response _response; - private final RetainableByteBufferPool _bufferPool; + private final ByteBufferPool _bufferPool; private final ServletRequestState _channelState; private final SharedBlockingCallback _writeBlocker; private ApiState _apiState = ApiState.BLOCKING; @@ -151,7 +151,7 @@ public HttpOutput(Response response, ServletChannel channel) _response = response; _servletChannel = channel; _connectionMetaData = _response.getRequest().getConnectionMetaData(); - _bufferPool = _response.getRequest().getComponents().getRetainableByteBufferPool(); + _bufferPool = _response.getRequest().getComponents().getByteBufferPool(); _channelState = _servletChannel.getState(); _writeBlocker = new WriteBlocker(_servletChannel); diff --git a/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-sessions/jetty-ee10-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee10/session/jdbc/ReloadedSessionMissingClassTest.java b/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-sessions/jetty-ee10-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee10/session/jdbc/ReloadedSessionMissingClassTest.java index 4fd6897465e2..73dbc453454f 100644 --- a/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-sessions/jetty-ee10-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee10/session/jdbc/ReloadedSessionMissingClassTest.java +++ b/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-sessions/jetty-ee10-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee10/session/jdbc/ReloadedSessionMissingClassTest.java @@ -43,7 +43,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; - /** * ReloadedSessionMissingClassTest */ diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketContainer.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketContainer.java index cd4ad79dc5b9..73eb840e98b3 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketContainer.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketContainer.java @@ -24,7 +24,7 @@ import jakarta.websocket.Extension; import jakarta.websocket.WebSocketContainer; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.Dumpable; @@ -53,9 +53,9 @@ public JakartaWebSocketContainer(WebSocketComponents components) protected abstract JakartaWebSocketFrameHandlerFactory getFrameHandlerFactory(); - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return components.getRetainableByteBufferPool(); + return components.getByteBufferPool(); } public WebSocketExtensionRegistry getExtensionRegistry() diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java index 70ef22ee04fe..ad829a660326 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java @@ -49,12 +49,12 @@ protected JakartaWebSocketRemoteEndpoint(JakartaWebSocketSession session, CoreSe protected MessageWriter newMessageWriter() { - return new MessageWriter(coreSession, session.getContainerImpl().getRetainableByteBufferPool()); + return new MessageWriter(coreSession, session.getContainerImpl().getByteBufferPool()); } protected MessageOutputStream newMessageOutputStream() { - return new MessageOutputStream(coreSession, session.getContainerImpl().getRetainableByteBufferPool()); + return new MessageOutputStream(coreSession, session.getContainerImpl().getByteBufferPool()); } @Override diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/AbstractSessionTest.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/AbstractSessionTest.java index 8a68ff66a040..e86f8cca33b9 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/AbstractSessionTest.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/AbstractSessionTest.java @@ -19,7 +19,7 @@ import jakarta.websocket.Endpoint; import jakarta.websocket.EndpointConfig; import jakarta.websocket.Session; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.junit.jupiter.api.AfterAll; @@ -64,9 +64,9 @@ public WebSocketComponents getWebSocketComponents() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return components.getRetainableByteBufferPool(); + return components.getByteBufferPool(); } public void waitForDemand(long timeout, TimeUnit timeUnit) throws InterruptedException diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/messages/MessageWriterTest.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/messages/MessageWriterTest.java index d44872ae9882..64bcdb1cbfde 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/messages/MessageWriterTest.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee10/websocket/jakarta/common/messages/MessageWriterTest.java @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.websocket.core.CoreSession; @@ -34,7 +34,7 @@ public class MessageWriterTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testSingleByteArray512b() throws IOException, InterruptedException diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/tests/LocalServer.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/tests/LocalServer.java index ede2a226289d..8f68771fda6b 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/tests/LocalServer.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee10/websocket/jakarta/tests/LocalServer.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.ee10.websocket.jakarta.server.internal.JakartaWebSocketServerContainer; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -60,7 +60,7 @@ public String echo(String msg) } private static final Logger LOG = LoggerFactory.getLogger(LocalServer.class); - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); private Server server; private ServerConnector connector; private LocalConnector localConnector; diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee10/websocket/client/WebSocketClient.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee10/websocket/client/WebSocketClient.java index b23fb35da406..7a6f15133435 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee10/websocket/client/WebSocketClient.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee10/websocket/client/WebSocketClient.java @@ -39,8 +39,8 @@ import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandler; import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandlerFactory; import org.eclipse.jetty.ee10.websocket.common.SessionTracker; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.Graceful; @@ -333,9 +333,9 @@ public void setCookieStore(CookieStore cookieStore) getHttpClient().setCookieStore(cookieStore); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return getHttpClient().getRetainableByteBufferPool(); + return getHttpClient().getByteBufferPool(); } @Override diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/MessageOutputStreamTest.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/MessageOutputStreamTest.java index 273de5d31e30..a99c343a0c1c 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/MessageOutputStreamTest.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/MessageOutputStreamTest.java @@ -19,8 +19,8 @@ import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream; import org.junit.jupiter.api.AfterEach; @@ -40,7 +40,7 @@ public class MessageOutputStreamTest private static final int OUTPUT_BUFFER_SIZE = 4096; private final AtomicInteger leaks = new AtomicInteger(); - private RetainableByteBufferPool bufferPool; + private ByteBufferPool bufferPool; private OutgoingMessageCapture sessionCapture; @BeforeEach diff --git a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/OutgoingMessageCapture.java b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/OutgoingMessageCapture.java index e0ac3175b60c..df12002a278e 100644 --- a/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/OutgoingMessageCapture.java +++ b/jetty-ee10/jetty-ee10-websocket/jetty-ee10-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee10/websocket/common/OutgoingMessageCapture.java @@ -20,7 +20,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.toolchain.test.Hex; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CloseStatus; @@ -41,7 +41,7 @@ public class OutgoingMessageCapture extends CoreSession.Empty implements CoreSes public BlockingQueue binaryMessages = new LinkedBlockingDeque<>(); public BlockingQueue events = new LinkedBlockingDeque<>(); - private final RetainableByteBufferPool bufferPool = new RetainableByteBufferPool.NonPooling(); + private final ByteBufferPool bufferPool = new ByteBufferPool.NonPooling(); private final MethodHandle wholeTextHandle; private final MethodHandle wholeBinaryHandle; private MessageSink messageSink; @@ -128,7 +128,7 @@ public void sendFrame(Frame frame, Callback callback, boolean batch) } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/MavenServerConnector.java b/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/MavenServerConnector.java index 52e902574dc5..b2b52b7d8359 100644 --- a/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/MavenServerConnector.java +++ b/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/MavenServerConnector.java @@ -18,8 +18,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.ConnectionFactory; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; @@ -149,9 +149,9 @@ public Scheduler getScheduler() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return checkDelegate().getRetainableByteBufferPool(); + return checkDelegate().getByteBufferPool(); } @Override diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpChannel.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpChannel.java index c72036b2eca6..ba673de9352d 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpChannel.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpChannel.java @@ -43,11 +43,11 @@ import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.MetaData; import org.eclipse.jetty.http.Trailers; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.QuietException; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.server.AbstractConnector; import org.eclipse.jetty.server.ConnectionMetaData; import org.eclipse.jetty.server.Connector; @@ -312,9 +312,9 @@ public void setIdleTimeout(long timeoutMs) _endPoint.setIdleTimeout(timeoutMs); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return _connector.getRetainableByteBufferPool(); + return _connector.getByteBufferPool(); } public HttpConfiguration getHttpConfiguration() diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpOutput.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpOutput.java index 045368e06af1..9413c2da8984 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpOutput.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/HttpOutput.java @@ -647,7 +647,7 @@ public ByteBuffer getByteBuffer() private RetainableByteBuffer acquireBuffer() { if (_aggregate == null) - _aggregate = _channel.getRetainableByteBufferPool().acquire(getBufferSize(), _channel.isUseOutputDirectByteBuffers()); + _aggregate = _channel.getByteBufferPool().acquire(getBufferSize(), _channel.isUseOutputDirectByteBuffers()); return _aggregate; } @@ -1083,7 +1083,7 @@ private void print(String s, boolean eoln) throws IOException encoder.reset(); } - RetainableByteBuffer out = getHttpChannel().getRetainableByteBufferPool().acquire((int)(1 + (s.length() + 2) * encoder.averageBytesPerChar()), false); + RetainableByteBuffer out = getHttpChannel().getByteBufferPool().acquire((int)(1 + (s.length() + 2) * encoder.averageBytesPerChar()), false); try { CharBuffer in = CharBuffer.wrap(s); @@ -1119,7 +1119,7 @@ else if (crlf != null && crlf.hasRemaining()) if (result.isOverflow()) { BufferUtil.flipToFlush(byteBuffer, 0); - RetainableByteBuffer bigger = _channel.getRetainableByteBufferPool().acquire(out.capacity() + s.length() + 2, out.isDirect()); + RetainableByteBuffer bigger = _channel.getByteBufferPool().acquire(out.capacity() + s.length() + 2, out.isDirect()); BufferUtil.flipToFill(bigger.getByteBuffer()); bigger.getByteBuffer().put(byteBuffer); out.release(); @@ -1736,7 +1736,7 @@ private InputStreamWritingCB(InputStream in, Callback callback) super(callback, true); _in = in; // Reading from InputStream requires byte[], don't use direct buffers. - _buffer = _channel.getRetainableByteBufferPool().acquire(getBufferSize(), false); + _buffer = _channel.getByteBufferPool().acquire(getBufferSize(), false); } @Override @@ -1811,7 +1811,7 @@ private ReadableByteChannelWritingCB(ReadableByteChannel in, Callback callback) { super(callback, true); _in = in; - _buffer = _channel.getRetainableByteBufferPool().acquire(getBufferSize(), _channel.isUseOutputDirectByteBuffers()); + _buffer = _channel.getByteBufferPool().acquire(getBufferSize(), _channel.isUseOutputDirectByteBuffers()); } @Override diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ResourceHandler.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ResourceHandler.java index ec4913c5b7fc..1557584d9547 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ResourceHandler.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ResourceHandler.java @@ -35,7 +35,7 @@ import org.eclipse.jetty.http.content.ResourceHttpContentFactory; import org.eclipse.jetty.http.content.ValidatingCachingHttpContentFactory; import org.eclipse.jetty.http.content.VirtualHttpContentFactory; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.resource.Resource; @@ -54,7 +54,7 @@ public class ResourceHandler extends HandlerWrapper implements ResourceFactory, { private static final Logger LOG = LoggerFactory.getLogger(ResourceHandler.class); - private RetainableByteBufferPool _bufferPool; + private ByteBufferPool _bufferPool; Resource _baseResource; ContextHandler _context; Resource _defaultStyleSheet; @@ -105,7 +105,7 @@ public void doStart() throws Exception if (_mimeTypes == null) _mimeTypes = _context == null ? MimeTypes.DEFAULTS : _context.getMimeTypes(); - _bufferPool = getRetainableByteBufferPool(_context); + _bufferPool = getByteBufferPool(_context); if (_resourceService.getHttpContentFactory() == null) _resourceService.setHttpContentFactory(newHttpContentFactory()); _resourceService.setWelcomeFactory(this); @@ -113,14 +113,14 @@ public void doStart() throws Exception super.doStart(); } - private static RetainableByteBufferPool getRetainableByteBufferPool(ContextHandler contextHandler) + private static ByteBufferPool getByteBufferPool(ContextHandler contextHandler) { if (contextHandler == null) - return new RetainableByteBufferPool.NonPooling(); + return new ByteBufferPool.NonPooling(); Server server = contextHandler.getServer(); if (server == null) - return new RetainableByteBufferPool.NonPooling(); - return server.getRetainableByteBufferPool(); + return new ByteBufferPool.NonPooling(); + return server.getByteBufferPool(); } public HttpContent.Factory getHttpContentFactory() diff --git a/jetty-ee9/jetty-ee9-nested/src/test/java/org/eclipse/jetty/ee9/nested/MockConnector.java b/jetty-ee9/jetty-ee9-nested/src/test/java/org/eclipse/jetty/ee9/nested/MockConnector.java index a247a95607b3..0681f1ce8bc4 100644 --- a/jetty-ee9/jetty-ee9-nested/src/test/java/org/eclipse/jetty/ee9/nested/MockConnector.java +++ b/jetty-ee9/jetty-ee9-nested/src/test/java/org/eclipse/jetty/ee9/nested/MockConnector.java @@ -27,7 +27,7 @@ public MockConnector() public MockConnector(Server server) { - super(server, server.getThreadPool(), server.getScheduler(), server.getRetainableByteBufferPool(), 0); + super(server, server.getThreadPool(), server.getScheduler(), server.getByteBufferPool(), 0); } @Override diff --git a/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi/src/test/java/org/eclipse/jetty/ee9/osgi/test/TestJettyOSGiAnnotationParser.java b/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi/src/test/java/org/eclipse/jetty/ee9/osgi/test/TestJettyOSGiAnnotationParser.java index 27f7d6585b0d..ec328dceb0ef 100644 --- a/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi/src/test/java/org/eclipse/jetty/ee9/osgi/test/TestJettyOSGiAnnotationParser.java +++ b/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi/src/test/java/org/eclipse/jetty/ee9/osgi/test/TestJettyOSGiAnnotationParser.java @@ -41,7 +41,6 @@ import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; - /** * TestJettyOSGiAnnotationParser * diff --git a/jetty-ee9/jetty-ee9-proxy/src/main/java/org/eclipse/jetty/ee9/proxy/AsyncMiddleManServlet.java b/jetty-ee9/jetty-ee9-proxy/src/main/java/org/eclipse/jetty/ee9/proxy/AsyncMiddleManServlet.java index 74f4e6b9aecf..27668245dd0d 100644 --- a/jetty-ee9/jetty-ee9-proxy/src/main/java/org/eclipse/jetty/ee9/proxy/AsyncMiddleManServlet.java +++ b/jetty-ee9/jetty-ee9-proxy/src/main/java/org/eclipse/jetty/ee9/proxy/AsyncMiddleManServlet.java @@ -43,9 +43,9 @@ import org.eclipse.jetty.client.Response; import org.eclipse.jetty.client.Result; import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Content; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.server.handler.ConnectHandler; import org.eclipse.jetty.util.BufferUtil; @@ -775,7 +775,7 @@ public GZIPContentTransformer(HttpClient httpClient, ContentTransformer transfor try { this.transformer = transformer; - RetainableByteBufferPool byteBufferPool = httpClient == null ? null : httpClient.getRetainableByteBufferPool(); + ByteBufferPool byteBufferPool = httpClient == null ? null : httpClient.getByteBufferPool(); this.decoder = new GZIPContentDecoder(byteBufferPool, GZIPContentDecoder.DEFAULT_BUFFER_SIZE); this.out = new ByteArrayOutputStream(); this.gzipOut = new GZIPOutputStream(out); diff --git a/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/DefaultServlet.java b/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/DefaultServlet.java index d47b8f18e91a..1ac81c1abe4c 100644 --- a/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/DefaultServlet.java +++ b/jetty-ee9/jetty-ee9-servlet/src/main/java/org/eclipse/jetty/ee9/servlet/DefaultServlet.java @@ -41,7 +41,7 @@ import org.eclipse.jetty.http.content.ResourceHttpContentFactory; import org.eclipse.jetty.http.content.ValidatingCachingHttpContentFactory; import org.eclipse.jetty.http.content.VirtualHttpContentFactory; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.URIUtil; @@ -261,7 +261,7 @@ public void init() long cacheValidationTime = getInitParameter("cacheValidationTime") != null ? Long.parseLong(getInitParameter("cacheValidationTime")) : -2; if (maxCachedFiles != -2 || maxCacheSize != -2 || maxCachedFileSize != -2 || cacheValidationTime != -2) { - RetainableByteBufferPool bufferPool = getRetainableByteBufferPool(_contextHandler); + ByteBufferPool bufferPool = getByteBufferPool(_contextHandler); _cachingContentFactory = new ValidatingCachingHttpContentFactory(contentFactory, (cacheValidationTime > -2) ? cacheValidationTime : Duration.ofSeconds(1).toMillis(), bufferPool); contentFactory = _cachingContentFactory; @@ -301,14 +301,14 @@ public void init() LOG.debug("resource base = {}", _baseResource); } - private static RetainableByteBufferPool getRetainableByteBufferPool(ContextHandler contextHandler) + private static ByteBufferPool getByteBufferPool(ContextHandler contextHandler) { if (contextHandler == null) - return new RetainableByteBufferPool.NonPooling(); + return new ByteBufferPool.NonPooling(); Server server = contextHandler.getServer(); if (server == null) - return new RetainableByteBufferPool.NonPooling(); - return server.getRetainableByteBufferPool(); + return new ByteBufferPool.NonPooling(); + return server.getByteBufferPool(); } private String getInitParameter(String name, String... deprecated) diff --git a/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-sessions/jetty-ee9-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee9/session/jdbc/ReloadedSessionMissingClassTest.java b/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-sessions/jetty-ee9-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee9/session/jdbc/ReloadedSessionMissingClassTest.java index eb8b044c2163..db54a76e9afd 100644 --- a/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-sessions/jetty-ee9-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee9/session/jdbc/ReloadedSessionMissingClassTest.java +++ b/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-sessions/jetty-ee9-test-sessions-jdbc/src/test/java/org/eclipse/jetty/ee9/session/jdbc/ReloadedSessionMissingClassTest.java @@ -43,7 +43,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; - /** * ReloadedSessionMissingClassTest */ diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketContainer.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketContainer.java index 50a2e85ef837..867c67e84f72 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketContainer.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketContainer.java @@ -24,7 +24,7 @@ import jakarta.websocket.Extension; import jakarta.websocket.WebSocketContainer; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.Dumpable; @@ -53,9 +53,9 @@ public JakartaWebSocketContainer(WebSocketComponents components) protected abstract JakartaWebSocketFrameHandlerFactory getFrameHandlerFactory(); - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return components.getRetainableByteBufferPool(); + return components.getByteBufferPool(); } public WebSocketExtensionRegistry getExtensionRegistry() diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java index fdb264cc1e52..be674872be4a 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/common/JakartaWebSocketRemoteEndpoint.java @@ -49,12 +49,12 @@ protected JakartaWebSocketRemoteEndpoint(JakartaWebSocketSession session, CoreSe protected MessageWriter newMessageWriter() { - return new MessageWriter(coreSession, session.getContainerImpl().getRetainableByteBufferPool()); + return new MessageWriter(coreSession, session.getContainerImpl().getByteBufferPool()); } protected MessageOutputStream newMessageOutputStream() { - return new MessageOutputStream(coreSession, session.getContainerImpl().getRetainableByteBufferPool()); + return new MessageOutputStream(coreSession, session.getContainerImpl().getByteBufferPool()); } @Override diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/AbstractSessionTest.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/AbstractSessionTest.java index 38ee82565930..03de65a60df4 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/AbstractSessionTest.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/AbstractSessionTest.java @@ -19,7 +19,7 @@ import jakarta.websocket.Endpoint; import jakarta.websocket.EndpointConfig; import jakarta.websocket.Session; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.junit.jupiter.api.AfterAll; @@ -64,9 +64,9 @@ public WebSocketComponents getWebSocketComponents() } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return components.getRetainableByteBufferPool(); + return components.getByteBufferPool(); } public void waitForDemand(long timeout, TimeUnit timeUnit) throws InterruptedException diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/messages/MessageWriterTest.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/messages/MessageWriterTest.java index 9bfc413c9049..fd29ba5bd885 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/messages/MessageWriterTest.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-common/src/test/java/org/eclipse/jetty/ee9/websocket/jakarta/common/messages/MessageWriterTest.java @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.websocket.core.CoreSession; @@ -34,7 +34,7 @@ public class MessageWriterTest { - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); @Test public void testSingleByteArray512b() throws IOException, InterruptedException diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/tests/LocalServer.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/tests/LocalServer.java index e0a1700b5d2a..ca1202eae88b 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/tests/LocalServer.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jakarta-tests/src/main/java/org/eclipse/jetty/ee9/websocket/jakarta/tests/LocalServer.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.ee9.websocket.jakarta.server.internal.JakartaWebSocketServerContainer; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; @@ -60,7 +60,7 @@ public String echo(String msg) } private static final Logger LOG = LoggerFactory.getLogger(LocalServer.class); - private final RetainableByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); + private final ByteBufferPool bufferPool = new ArrayRetainableByteBufferPool(); private Server server; private ServerConnector connector; private LocalConnector localConnector; diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee9/websocket/client/WebSocketClient.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee9/websocket/client/WebSocketClient.java index d83492838d69..87387e557e5e 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee9/websocket/client/WebSocketClient.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-client/src/main/java/org/eclipse/jetty/ee9/websocket/client/WebSocketClient.java @@ -40,8 +40,8 @@ import org.eclipse.jetty.ee9.websocket.common.JettyWebSocketFrameHandler; import org.eclipse.jetty.ee9.websocket.common.JettyWebSocketFrameHandlerFactory; import org.eclipse.jetty.ee9.websocket.common.SessionTracker; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.Graceful; @@ -334,9 +334,9 @@ public void setCookieStore(CookieStore cookieStore) getHttpClient().setCookieStore(cookieStore); } - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { - return getHttpClient().getRetainableByteBufferPool(); + return getHttpClient().getByteBufferPool(); } @Override diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/MessageOutputStreamTest.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/MessageOutputStreamTest.java index eb43d0acf25b..85b23b06de3e 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/MessageOutputStreamTest.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/MessageOutputStreamTest.java @@ -19,8 +19,8 @@ import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jetty.io.ArrayRetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.RetainableByteBuffer; -import org.eclipse.jetty.io.RetainableByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.websocket.core.internal.messages.MessageOutputStream; import org.junit.jupiter.api.AfterEach; @@ -40,7 +40,7 @@ public class MessageOutputStreamTest private static final int OUTPUT_BUFFER_SIZE = 4096; private final AtomicInteger leaks = new AtomicInteger(); - private RetainableByteBufferPool bufferPool; + private ByteBufferPool bufferPool; private OutgoingMessageCapture sessionCapture; @BeforeEach diff --git a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/OutgoingMessageCapture.java b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/OutgoingMessageCapture.java index 7e0a2c3853f0..f0e62eb0536c 100644 --- a/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/OutgoingMessageCapture.java +++ b/jetty-ee9/jetty-ee9-websocket/jetty-ee9-websocket-jetty-common/src/test/java/org/eclipse/jetty/ee9/websocket/common/OutgoingMessageCapture.java @@ -20,7 +20,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; -import org.eclipse.jetty.io.RetainableByteBufferPool; +import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.toolchain.test.Hex; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CloseStatus; @@ -41,7 +41,7 @@ public class OutgoingMessageCapture extends CoreSession.Empty implements CoreSes public BlockingQueue binaryMessages = new LinkedBlockingDeque<>(); public BlockingQueue events = new LinkedBlockingDeque<>(); - private final RetainableByteBufferPool bufferPool = new RetainableByteBufferPool.NonPooling(); + private final ByteBufferPool bufferPool = new ByteBufferPool.NonPooling(); private final MethodHandle wholeTextHandle; private final MethodHandle wholeBinaryHandle; private MessageSink messageSink; @@ -128,7 +128,7 @@ public void sendFrame(Frame frame, Callback callback, boolean batch) } @Override - public RetainableByteBufferPool getRetainableByteBufferPool() + public ByteBufferPool getByteBufferPool() { return bufferPool; } diff --git a/pom.xml b/pom.xml index c1a7d4f5d56c..af8a9766f696 100644 --- a/pom.xml +++ b/pom.xml @@ -2142,6 +2142,43 @@ true + + reformat + + true + true + true + true + true + + + + + net.revelc.code + impsort-maven-plugin + 1.8.0 + + java,* + * + + **/module-info.java + + 14_PREVIEW + true + false + + + + sort-imports + + sort + + + + + + +