Package org.infinispan.container.impl
Class EntryFactoryImpl
- java.lang.Object
-
- org.infinispan.container.impl.EntryFactoryImpl
-
- All Implemented Interfaces:
EntryFactory
public class EntryFactoryImpl extends Object implements EntryFactory
EntryFactoryimplementation to be used for optimistic locking scheme.- Since:
- 5.1
- Author:
- Mircea Markus
-
-
Constructor Summary
Constructors Constructor Description EntryFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MVCCEntry<?,?>createWrappedEntry(Object key, CacheEntry<?,?> cacheEntry)voidinit()voidwrapEntryForExpired(InvocationContext ctx, Object key, int segment)Insert an entry that exists in the data container into the context, even if it is expired Doesn't do anything if the key was already wrappedCompletionStage<Void>wrapEntryForReading(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean hasLock, CompletionStage<Void> previousStage)Wraps an entry for reading.CompletionStage<Void>wrapEntryForWriting(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean isRead, CompletionStage<Void> previousStage)Insert an entry that exists in the data container into the context.voidwrapExternalEntry(InvocationContext ctx, Object key, CacheEntry externalEntry, boolean isRead, boolean isWrite)Insert an external entry (e.g.
-
-
-
Method Detail
-
init
public void init()
-
wrapEntryForReading
public final CompletionStage<Void> wrapEntryForReading(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean hasLock, CompletionStage<Void> previousStage)
Description copied from interface:EntryFactoryWraps an entry for reading. Usually this is just a rawCacheEntrybut certain combinations of isolation levels and the presence of an ongoing JTA transaction may force this to be a proper, wrapped MVCCEntry. The entry is also typically placed in the invocation context.- Specified by:
wrapEntryForReadingin interfaceEntryFactory- Parameters:
ctx- current invocation contextkey- key to look up and wrapsegment- segment for the keyisOwner- true if this node is current owner in readCH (or we ignore CH)hasLock- true if the invoker already has the lock for this keypreviousStage- if wrapping can't be performed synchronously, only access the invocation context from another thread after this stage is complete- Returns:
- stage that when complete the value should be in the context
-
wrapEntryForWriting
public CompletionStage<Void> wrapEntryForWriting(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean isRead, CompletionStage<Void> previousStage)
Description copied from interface:EntryFactoryInsert an entry that exists in the data container into the context. Doesn't do anything if the key was already wrapped.The returned stage will always be complete if isOwner is false.
- Specified by:
wrapEntryForWritingin interfaceEntryFactory- Parameters:
ctx- current invocation contextkey- key to look up and wrapsegment- segment for the keyisOwner- true if this node is current owner in readCH (or we ignore CH)isRead- true if this operation is expected to read the value of the entrypreviousStage- if wrapping can't be performed synchronously, only access the invocation context from another thread after this stage is complete
-
wrapEntryForExpired
public void wrapEntryForExpired(InvocationContext ctx, Object key, int segment)
Description copied from interface:EntryFactoryInsert an entry that exists in the data container into the context, even if it is expired Doesn't do anything if the key was already wrapped- Specified by:
wrapEntryForExpiredin interfaceEntryFactory- Parameters:
ctx- current invocation contextkey- key to look up and wrapsegment- segment for the key
-
wrapExternalEntry
public void wrapExternalEntry(InvocationContext ctx, Object key, CacheEntry externalEntry, boolean isRead, boolean isWrite)
Description copied from interface:EntryFactoryInsert an external entry (e.g. loaded from a cache loader or from a remote node) into the context.- Specified by:
wrapExternalEntryin interfaceEntryFactory- Parameters:
ctx- current invocation contextkey- key to look up and wrapexternalEntry- the value to be inserted into contextisRead- true if this operation is expected to read the value of the entryisWrite- if this is executed within a write command
-
createWrappedEntry
protected MVCCEntry<?,?> createWrappedEntry(Object key, CacheEntry<?,?> cacheEntry)
-
-