From f3f8f80bb59d6526ebe7a3b5112c6f9981ed4b2c Mon Sep 17 00:00:00 2001 From: gregw Date: Tue, 14 Jan 2025 08:41:48 +1100 Subject: [PATCH] Merge remote-tracking branch 'origin/fix/jetty-12.1.x/12681-cached-content-already-released' into fix/jetty-12.1.x/serlvet6-demos # Conflicts: # jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/content/CachingHttpContentFactory.java --- .../eclipse/jetty/http/content/CachingHttpContentFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 9411d63d0da..b60d3f7529d 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 @@ -367,7 +367,7 @@ public void writeTo(Content.Sink sink, long offset, long length, Callback callba boolean retained = false; try { - retained = retain(); + retained = cachedRetain(); if (retained) sink.write(true, BufferUtil.slice(_buffer.getByteBuffer(), Math.toIntExact(offset), Math.toIntExact(length)), Callback.from(this::release, callback)); else @@ -388,7 +388,7 @@ public void writeTo(Content.Sink sink, long offset, long length, Callback callba * its internal buffer if it is. * @return true if this content can be used and has been retained, false otherwise. */ - private boolean retain() + private boolean cachedRetain() { return _cache.computeIfPresent(_cacheKey, (s, cachingHttpContent) -> {