public abstract class AbstractPool<I,O> extends Object
<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.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_POOL_CAPACITY |
Constructor and Description |
---|
AbstractPool() |
AbstractPool(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected abstract O |
create(I value)
Create a new entry.
|
O |
getOrCreate(I value)
Returns and interned entry if possible, a new one otherwise.
|
protected int |
hashCode(I value) |
protected abstract boolean |
isEqual(O entry,
I value)
Returns
true if the entry content is equal to value ; |
public static final int DEFAULT_POOL_CAPACITY
public AbstractPool()
public AbstractPool(int capacity)
Copyright © 2019 JBoss by Red Hat. All rights reserved.