From 830a9b8264648798e5800475a85135ba65e5aab3 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 21 Aug 2023 19:52:25 -0700 Subject: [PATCH] Minor tweaking --- .../com/fasterxml/jackson/core/JsonFactory.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/core/JsonFactory.java b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java index 3699d0a653..52e79a0d02 100644 --- a/src/main/java/com/fasterxml/jackson/core/JsonFactory.java +++ b/src/main/java/com/fasterxml/jackson/core/JsonFactory.java @@ -2138,13 +2138,23 @@ protected JsonGenerator _decorate(JsonGenerator g) { */ public BufferRecycler _getBufferRecycler() { + return _getBufferRecyclerPool().acquireBufferRecycler(this); + } + + /** + * Accessor for getting access to {@link BufferRecyclerPool} for getting + * {@link BufferRecycler} instance to use. + * + * @since 2.16 + */ + public BufferRecyclerPool _getBufferRecyclerPool() { // 23-Apr-2015, tatu: Let's allow disabling of buffer recycling // scheme, for cases where it is considered harmful (possibly // on Android, for example) if (!Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING.enabledIn(_factoryFeatures)) { - return new BufferRecycler(); + return BufferRecyclers.nopRecyclerPool(); } - return _bufferRecyclerPool.acquireBufferRecycler(this); + return _bufferRecyclerPool; } /**