protected abstract static class Pool.AccessUnit<E>
extends java.lang.Object
buffer
for processing the collision values at a particular index in the WeakInterningHashSet.entries
.
Access units are recycled for reuse in subsequent accesses.
Because of shared multi-threaded read access, there may be as many instances as there are threads simultaneously accessing the pool.Modifier and Type | Class and Description |
---|---|
protected static class |
Pool.AccessUnit.Queue<E> |
Modifier and Type | Field and Description |
---|---|
protected WeakInterningHashSet.Entry<E> |
createdEntry |
protected WeakInterningHashSet.Entry<E>[] |
entries |
protected int |
hashCode
The hash code of the object being accessed.
|
protected int |
matchingIndex
This records during
match() the matching index. |
protected Pool.AccessUnit<E> |
next
Access units are chained in
Pool#accessUnits via this link. |
protected Pool.AccessUnit.Queue<E> |
queue
Access units are maintained for recycled use in this queue.
|
protected java.lang.Object[] |
values |
protected int |
valuesLength
This records the number of
values cached for this access. |
Modifier | Constructor and Description |
---|---|
protected |
Pool.AccessUnit(Pool.AccessUnit.Queue<E> queue) |
Modifier and Type | Method and Description |
---|---|
void |
add(E value,
WeakInterningHashSet.Entry<E> entry)
Add a value to the
values incrementing the valuesLength . |
protected WeakInterningHashSet.Entry<E> |
getEntry() |
E |
getInternalizedValue()
Gets the value that should be added to the pool.
|
protected abstract E |
getValue() |
E |
match()
Used to return a value from among the
values that matches(Object) the value being accessed. |
protected boolean |
matches(E value)
Used to determine whether the given value from the pool is equal to the value being accessed.
|
boolean |
rematches(E value,
WeakInterningHashSet.Entry<E> entry)
Used to determine whether the given value from the pool is equal to the value being accessed.
|
void |
reset(boolean isExclusive)
Prepare the access unit for reuse.
|
protected abstract boolean |
setArbitraryValue(java.lang.Object value) |
protected abstract void |
setValue(E value) |
protected final Pool.AccessUnit.Queue<E> queue
protected Pool.AccessUnit<E> next
Pool#accessUnits
via this link.protected int hashCode
protected java.lang.Object[] values
protected int valuesLength
values
cached for this access.protected int matchingIndex
match()
the matching index.protected WeakInterningHashSet.Entry<E> createdEntry
protected WeakInterningHashSet.Entry<E>[] entries
protected Pool.AccessUnit(Pool.AccessUnit.Queue<E> queue)
protected abstract E getValue()
protected abstract void setValue(E value)
protected abstract boolean setArbitraryValue(java.lang.Object value)
protected WeakInterningHashSet.Entry<E> getEntry()
public E getInternalizedValue()
protected boolean matches(E value)
Object.equals(Object)
.public final boolean rematches(E value, WeakInterningHashSet.Entry<E> entry)
double checking
the match after acquiring the write lock
so it can safely any values previous cached.public E match()
values
that matches(Object)
the value being accessed.
Returns null
if there is no such matching value.public void add(E value, WeakInterningHashSet.Entry<E> entry)
values
incrementing the valuesLength
.public void reset(boolean isExclusive)
#getValues()
and #getEntries()
and then reset the valuesLength
to 0