public abstract class Chaining extends ChainingInterface
Modifier and Type | Field and Description |
---|---|
List<ChainingInterface> |
contextChain |
int |
indexInContextChain |
ChainingInterface |
rootContextInThisThread
First context, ever created in this thread.
|
boolean |
used |
iterationContextLockedInThisThread
Constructor and Description |
---|
Chaining(ChainingInterface rootContextInThisThread,
net.openhft.chronicle.map.VanillaChronicleMap map) |
Chaining(net.openhft.chronicle.map.VanillaChronicleMap map) |
Modifier and Type | Method and Description |
---|---|
<T> T |
contextAtIndexInChain(int index) |
<T extends ChainingInterface> |
getContext(Class<? extends T> contextClass,
BiFunction<ChainingInterface,net.openhft.chronicle.map.VanillaChronicleMap,T> createChaining,
net.openhft.chronicle.map.VanillaChronicleMap map) |
List<ChainingInterface> |
getContextChain() |
abstract void |
initMap(net.openhft.chronicle.map.VanillaChronicleMap map)
This method stores a reference to the context's owner ChronicleMap into a field of the
context in the beginning of each usage of the context.
|
void |
initUsed(boolean used,
net.openhft.chronicle.map.VanillaChronicleMap map)
Init method parameterized to avoid automatic initialization.
|
boolean |
usedInit() |
closeContext, isLocked, lockContextLocally, owner, preventClose, unlockContextLocally
public final List<ChainingInterface> contextChain
public final int indexInContextChain
public final ChainingInterface rootContextInThisThread
public boolean used
public Chaining(net.openhft.chronicle.map.VanillaChronicleMap map)
public Chaining(ChainingInterface rootContextInThisThread, net.openhft.chronicle.map.VanillaChronicleMap map)
public List<ChainingInterface> getContextChain()
getContextChain
in class ChainingInterface
public <T> T contextAtIndexInChain(int index)
public abstract void initMap(net.openhft.chronicle.map.VanillaChronicleMap map)
The chain of strong references:
1) Thread ->
2) ThreadLocalMap ->
3) Entry with ThreadLocal VanillaChronicleMap.cxt
as weak
referent and a context (e. g. CompiledMapQueryContext
)
as value (a simple field, not a weak reference!) ->
4) final reference to the owner VanillaChronicleMap
->
5) ThreadLocal VanillaChronicleMap.cxt
(a strong reference
this time! note that this ThreadLocal is an instance field of VanillaChronicleMap)
So in order to break this chain at step 4), contexts store references to their owner ChronicleMaps only when contexts are used.
public boolean usedInit()
usedInit
in class ChainingInterface
public void initUsed(boolean used, net.openhft.chronicle.map.VanillaChronicleMap map)
used
argument should
always be true
.initUsed
in class ChainingInterface
public <T extends ChainingInterface> T getContext(Class<? extends T> contextClass, BiFunction<ChainingInterface,net.openhft.chronicle.map.VanillaChronicleMap,T> createChaining, net.openhft.chronicle.map.VanillaChronicleMap map)
getContext
in class ChainingInterface
Copyright © 2022. All rights reserved.