public class BufferRecyclers
extends java.lang.Object
BufferRecycler
,
JsonStringEncoder
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
System property that is checked to see if recycled buffers (see
BufferRecycler )
should be tracked, for purpose of forcing release of all such buffers, typically
during major classloading. |
Constructor and Description |
---|
BufferRecyclers() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
encodeAsUTF8(java.lang.String text)
Helper method for encoding given String as UTF-8 encoded
|
static BufferRecycler |
getBufferRecycler()
Main accessor to call for accessing possibly recycled
BufferRecycler instance. |
static JsonStringEncoder |
getJsonStringEncoder() |
static void |
quoteAsJsonText(java.lang.CharSequence input,
java.lang.StringBuilder output) |
static char[] |
quoteAsJsonText(java.lang.String rawText) |
static byte[] |
quoteAsJsonUTF8(java.lang.String rawText) |
static int |
releaseBuffers()
Specialized method that will release all recycled
BufferRecycler if
(and only if) recycler tracking has been enabled
(see SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS ). |
public static final java.lang.String SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
BufferRecycler
)
should be tracked, for purpose of forcing release of all such buffers, typically
during major classloading.public static BufferRecycler getBufferRecycler()
BufferRecycler
instance.public static int releaseBuffers()
BufferRecycler
if
(and only if) recycler tracking has been enabled
(see SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS
).
This method is usually called on shutdown of the container like Application Server
to ensure that no references are reachable via ThreadLocal
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 up SoftReference
s aggressively enough.public static JsonStringEncoder getJsonStringEncoder()
public static byte[] encodeAsUTF8(java.lang.String text)
public static char[] quoteAsJsonText(java.lang.String rawText)
public static void quoteAsJsonText(java.lang.CharSequence input, java.lang.StringBuilder output)
public static byte[] quoteAsJsonUTF8(java.lang.String rawText)
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"