Package org.apache.hadoop.hbase.util
Class FastStringPool
java.lang.Object
org.apache.hadoop.hbase.util.FastStringPool
A string pool like
String.intern(), but more flexible as we can create multiple instances
and use them in difference places, where String.intern() is global.
We use WeakReference so when there are no actual reference to the String, it will be GCed
to reduce memory pressure.
The difference between WeakObjectPool is that, we also need to use WeakReference
as key, not only value, because the key(a String) is exactly what we want to deduplicate.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Lockprivate final AtomicIntegerprivate final ConcurrentHashMap<FastStringPool.WeakKey,WeakReference<String>> private final ReferenceQueue<String> -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
map
-
refQueue
-
cleanupLock
-
CLEANUP_MASK
- See Also:
-
counter
-
-
Constructor Details
-
FastStringPool
public FastStringPool()
-
-
Method Details
-
intern
-
cleanup
-
maybeCleanup
-
size
-