Class AbstractPool<I,O>
java.lang.Object
org.apache.activemq.artemis.utils.AbstractPool<I,O>
- Direct Known Subclasses:
SimpleString.StringSimpleStringPool
Thread-safe
<T> interner.
Differently from String.intern() it contains a fixed amount of entries and when used by concurrent threads it
doesn't ensure the uniqueness of the entries ie the same entry could be allocated multiple times by concurrent
calls.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract OCreate a new entry.final OgetOrCreate(I value) Returns and interned entry if possible, a new one otherwise.protected intprotected abstract booleanReturnstrueif theentrycontent is equal tovalue;.
-
Field Details
-
DEFAULT_POOL_CAPACITY
public static final int DEFAULT_POOL_CAPACITY- See Also:
-
-
Constructor Details
-
AbstractPool
public AbstractPool() -
AbstractPool
public AbstractPool(int capacity)
-
-
Method Details
-
create
Create a new entry. -
isEqual
Returnstrueif theentrycontent is equal tovalue;.- Returns:
trueif theentrycontent is equal tovalue;
-
hashCode
-
getOrCreate
Returns and interned entry if possible, a new one otherwise.The
byteBuf'sByteBuf.readerIndex()is incremented bylengthafter it.
-