Class BufferRecyclers
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.core.util.BufferRecyclers
Helper entity used to control access to simple buffer recyling scheme used for
some encoding, decoding tasks.
- Since:
- 2.9.2
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final ThreadLocal<SoftReference<BufferRecycler>>
ThisThreadLocal
contains aSoftReference
to aBufferRecycler
used to provide a low-cost buffer recycling between reader and writer instances.static final String
System property that is checked to see if recycled buffers (seeBufferRecycler
) should be tracked, for purpose of forcing release of all such buffers, typically during major classloading. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
encodeAsUTF8
(String text) Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)static BufferRecycler
Main accessor to call for accessing possibly recycledBufferRecycler
instance.static JsonStringEncoder
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)static void
quoteAsJsonText
(CharSequence input, StringBuilder output) Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)static char[]
quoteAsJsonText
(String rawText) Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)static byte[]
quoteAsJsonUTF8
(String rawText) Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)static int
Specialized method that will release all recycledBufferRecycler
if (and only if) recycler tracking has been enabled (seeSYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
).
-
Field Details
-
SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
System property that is checked to see if recycled buffers (seeBufferRecycler
) should be tracked, for purpose of forcing release of all such buffers, typically during major classloading.- Since:
- 2.9.6
- See Also:
-
_recyclerRef
ThisThreadLocal
contains aSoftReference
to aBufferRecycler
used to provide a low-cost buffer recycling between reader and writer instances.
-
-
Constructor Details
-
BufferRecyclers
public BufferRecyclers()
-
-
Method Details
-
getBufferRecycler
Main accessor to call for accessing possibly recycledBufferRecycler
instance.- Returns:
BufferRecycler
to use
-
releaseBuffers
public static int releaseBuffers()Specialized method that will release all recycledBufferRecycler
if (and only if) recycler tracking has been enabled (seeSYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
). This method is usually called on shutdown of the container like Application Server to ensure that no references are reachable viaThreadLocal
s as this may cause unintentional retention of sizable amounts of memory. It may also be called regularly if GC for some reason does not clear upSoftReference
s aggressively enough.- Returns:
- Number of buffers released, if tracking enabled (zero or more); -1 if tracking not enabled.
- Since:
- 2.9.6
-
getJsonStringEncoder
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)Not to be used any more: callJsonStringEncoder.getInstance()
instead.- Returns:
JsonStringEncoder
instance to use.
-
encodeAsUTF8
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)Not to be used any more: callJsonStringEncoder.getInstance()
(and thenencodeAsUTF8()
) instead.- Parameters:
text
- String to encode- Returns:
- String encoded as UTF-8 bytes.
-
quoteAsJsonText
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)Not to be used any more: callJsonStringEncoder.getInstance()
(and thenquoteAsString()
) instead.- Parameters:
rawText
- String to quote- Returns:
- Quoted text as
char[]
-
quoteAsJsonText
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)Not to be used any more: callJsonStringEncoder.getInstance()
(and thenquoteAsString()
) instead.- Parameters:
input
- Textual content to quoteoutput
- Builder to append quoted content
-
quoteAsJsonUTF8
Deprecated.Since 2.10 (note: was accidentally removed but reintroduced as deprecated in 2.12.5, to be removed from 3.0)Not to be used any more: callJsonStringEncoder.getInstance()
(and thenquoteAsUTF8()
) instead.- Parameters:
rawText
- String to quote- Returns:
- Quoted text as
byte[]
-