Skip to content

Commit 9ab0c70

Browse files
authored
Fix #1271: reprecate LockFreePool in 2.18 (to be removed from 3.0) (#1291)
1 parent d3afc9e commit 9ab0c70

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

release-notes/VERSION-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ a pure JSON library.
3030
to prevent use by downstream consumers
3131
(requested by @seadbrane)
3232
#1266: Change default recycler pool to `newConcurrentDequePool()` in 2.18
33+
#1271: Deprecate `LockFreePool` implementation in 2.18 (remove from 3.0)
3334
#1277: Add back Java 22 optimisation in FastDoubleParser
3435

3536
2.17.1 (04-May-2024)

src/main/java/com/fasterxml/jackson/core/util/JsonRecyclerPools.java

+19-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.fasterxml.jackson.core.JsonFactory;
77
import com.fasterxml.jackson.core.util.RecyclerPool.BoundedPoolBase;
88
import com.fasterxml.jackson.core.util.RecyclerPool.ConcurrentDequePoolBase;
9-
import com.fasterxml.jackson.core.util.RecyclerPool.LockFreePoolBase;
109

1110
/**
1211
* Set of {@link RecyclerPool} implementations to be used by the default
@@ -74,7 +73,11 @@ public static RecyclerPool<BufferRecycler> newConcurrentDequePool() {
7473
* Accessor for getting the shared/global {@link LockFreePool} instance.
7574
*
7675
* @return Globally shared instance of {@link LockFreePool}.
76+
*
77+
* @deprecated Since 2.18: use one of other implementations instead;
78+
* see {@link LockFreePool} Javadocs for details
7779
*/
80+
@Deprecated // since 2.18
7881
public static RecyclerPool<BufferRecycler> sharedLockFreePool() {
7982
return LockFreePool.GLOBAL;
8083
}
@@ -83,7 +86,11 @@ public static RecyclerPool<BufferRecycler> sharedLockFreePool() {
8386
* Accessor for constructing a new, non-shared {@link LockFreePool} instance.
8487
*
8588
* @return Globally shared instance of {@link LockFreePool}.
89+
*
90+
* @deprecated Since 2.18: use one of other implementations instead;
91+
* see {@link LockFreePool} Javadocs for details
8692
*/
93+
@Deprecated // since 2.18
8794
public static RecyclerPool<BufferRecycler> newLockFreePool() {
8895
return LockFreePool.construct();
8996
}
@@ -204,8 +211,18 @@ protected Object readResolve() {
204211
*<p>
205212
* Pool is unbounded: see {@link RecyclerPool} for
206213
* details on what this means.
214+
*<p>
215+
* NOTE: serious issues found with 2.17.0 lead to deprecation
216+
* of this implementation -- basically it is possible to have
217+
* unbalanced acquire/release success rate lead to excessive
218+
* growth of pooled instances.
219+
* See <a href="https://github.com/FasterXML/jackson-core/issues/1260">
220+
* jackson-core#1260</a> for details.
221+
*
222+
* @deprecated Since 2.18: use other implementations instead
207223
*/
208-
public static class LockFreePool extends LockFreePoolBase<BufferRecycler>
224+
@Deprecated
225+
public static class LockFreePool extends RecyclerPool.LockFreePoolBase<BufferRecycler>
209226
{
210227
private static final long serialVersionUID = 1L;
211228

src/main/java/com/fasterxml/jackson/core/util/RecyclerPool.java

+10
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,17 @@ public boolean clear() {
309309
* a lock free linked list for recycling instances.
310310
* Pool is unbounded: see {@link RecyclerPool} for
311311
* details on what this means.
312+
*<p>
313+
* NOTE: serious issues found with 2.17.0 lead to deprecation
314+
* of this implementation -- basically it is possible to have
315+
* unbalanced acquire/release success rate lead to excessive
316+
* growth of pooled instances.
317+
* See <a href="https://github.com/FasterXML/jackson-core/issues/1260">
318+
* jackson-core#1260</a> for details.
319+
*
320+
* @deprecated Since 2.18: use other implementations
312321
*/
322+
@Deprecated // since 2.18
313323
abstract class LockFreePoolBase<P extends WithPool<P>>
314324
extends StatefulImplBase<P>
315325
{

0 commit comments

Comments
 (0)