Package org.infinispan.xsite.irac
Enum NoOpIracManager
- java.lang.Object
-
- java.lang.Enum<NoOpIracManager>
-
- org.infinispan.xsite.irac.NoOpIracManager
-
- All Implemented Interfaces:
Serializable
,Comparable<NoOpIracManager>
,IracManager
public enum NoOpIracManager extends Enum<NoOpIracManager> implements IracManager
A no-op implementation ofIracManager
for cache without asynchronous remote site backups.- Since:
- 11.0
- Author:
- Pedro Ruivo
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Boolean>
checkAndTrackExpiration(Object key)
Checks if the given key is expired on all other sites.boolean
containsKey(Object key)
Checks if the key is present.void
incrementNumberOfConflictLocalWins()
Increase the count of conflicts if merge policy discard update (local value wins)void
incrementNumberOfConflictMerged()
Increase the count of conflicts if merge policy created a new value (merge remote value with local value)void
incrementNumberOfConflictRemoteWins()
Increase the count of conflicts if merge policy applies update (remote value wins)void
incrementNumberOfDiscards()
Increase the count of discards.void
onTopologyUpdate(CacheTopology oldCacheTopology, CacheTopology newCacheTopology)
Notifies a topology changed.void
receiveState(int segment, Object key, Object lockOwner, IracMetadata tombstone)
Receives the state related to thekey
.void
removeState(IracManagerKeyInfo state)
Removes the state associated to a single key.void
requestState(Address requestor, IntSet segments)
Requests the state stored in this instance for the givensegments
.void
trackClear(boolean sendClear)
Sets all keys as removed.void
trackExpiredKey(int segment, Object key, Object lockOwner)
Similar toIracManager.trackUpdatedKey(int, Object, Object)
but it tracks expired keys instead.CompletionStage<Void>
trackForStateTransfer(Collection<XSiteState> stateList)
Tracks a set of keys to be sent to the remote site.void
trackUpdatedKey(int segment, Object key, Object lockOwner)
Sets thekey
as changed by thelockOwner
.static NoOpIracManager
valueOf(String name)
Returns the enum constant of this type with the specified name.static NoOpIracManager[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final NoOpIracManager INSTANCE
-
-
Method Detail
-
values
public static NoOpIracManager[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NoOpIracManager c : NoOpIracManager.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NoOpIracManager valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
trackUpdatedKey
public void trackUpdatedKey(int segment, Object key, Object lockOwner)
Description copied from interface:IracManager
Sets thekey
as changed by thelockOwner
.- Specified by:
trackUpdatedKey
in interfaceIracManager
- Parameters:
segment
- The key's segment.key
- The key changed.lockOwner
- The lock owner who updated the key.
-
trackExpiredKey
public void trackExpiredKey(int segment, Object key, Object lockOwner)
Description copied from interface:IracManager
Similar toIracManager.trackUpdatedKey(int, Object, Object)
but it tracks expired keys instead.Expired key need a different conflict resolution algorithm since remove expired should never win any conflict.
- Specified by:
trackExpiredKey
in interfaceIracManager
- Parameters:
segment
- The key's segment.key
- The key expired.lockOwner
- The lock owner who updated the key.
-
trackForStateTransfer
public CompletionStage<Void> trackForStateTransfer(Collection<XSiteState> stateList)
Description copied from interface:IracManager
Tracks a set of keys to be sent to the remote site.There is no much difference between this method and
IracManager.trackUpdatedKey(int, Object, Object)
. It just returns aCompletionStage
to notify when the keys were sent. It is required by the cross-site state transfer protocol to know when it has finish.- Specified by:
trackForStateTransfer
in interfaceIracManager
- Parameters:
stateList
- The list ofXSiteState
.- Returns:
- A
CompletionStage
which is completed when all the keys instateList
have been sent to the remote site.
-
trackClear
public void trackClear(boolean sendClear)
Description copied from interface:IracManager
Sets all keys as removed.- Specified by:
trackClear
in interfaceIracManager
- Parameters:
sendClear
- iftrue
, anIracClearKeysCommand
is sent to the backup sites.
-
removeState
public void removeState(IracManagerKeyInfo state)
Description copied from interface:IracManager
Removes the state associated to a single key.- Specified by:
removeState
in interfaceIracManager
- Parameters:
state
- The state to remove.
-
onTopologyUpdate
public void onTopologyUpdate(CacheTopology oldCacheTopology, CacheTopology newCacheTopology)
Description copied from interface:IracManager
Notifies a topology changed.- Specified by:
onTopologyUpdate
in interfaceIracManager
- Parameters:
oldCacheTopology
- The oldCacheTopology
.newCacheTopology
- The newCacheTopology
.
-
requestState
public void requestState(Address requestor, IntSet segments)
Description copied from interface:IracManager
Requests the state stored in this instance for the givensegments
.- Specified by:
requestState
in interfaceIracManager
- Parameters:
requestor
- The requestor.segments
- The segments requested.
-
receiveState
public void receiveState(int segment, Object key, Object lockOwner, IracMetadata tombstone)
Description copied from interface:IracManager
Receives the state related to thekey
.- Specified by:
receiveState
in interfaceIracManager
- Parameters:
segment
- The key's segment.key
- The key modified.lockOwner
- The lastlockOwner
.tombstone
- The tombstone (can benull
)
-
checkAndTrackExpiration
public CompletionStage<Boolean> checkAndTrackExpiration(Object key)
Description copied from interface:IracManager
Checks if the given key is expired on all other sites. If the key is expired on all other sites this will return true- Specified by:
checkAndTrackExpiration
in interfaceIracManager
- Parameters:
key
- The key to check if it is expired or not- Returns:
- Whether this key is expired on all other sites
-
incrementNumberOfDiscards
public void incrementNumberOfDiscards()
Description copied from interface:IracManager
Increase the count of discards.- Specified by:
incrementNumberOfDiscards
in interfaceIracManager
-
incrementNumberOfConflictLocalWins
public void incrementNumberOfConflictLocalWins()
Description copied from interface:IracManager
Increase the count of conflicts if merge policy discard update (local value wins)- Specified by:
incrementNumberOfConflictLocalWins
in interfaceIracManager
-
incrementNumberOfConflictRemoteWins
public void incrementNumberOfConflictRemoteWins()
Description copied from interface:IracManager
Increase the count of conflicts if merge policy applies update (remote value wins)- Specified by:
incrementNumberOfConflictRemoteWins
in interfaceIracManager
-
incrementNumberOfConflictMerged
public void incrementNumberOfConflictMerged()
Description copied from interface:IracManager
Increase the count of conflicts if merge policy created a new value (merge remote value with local value)- Specified by:
incrementNumberOfConflictMerged
in interfaceIracManager
-
containsKey
public boolean containsKey(Object key)
Description copied from interface:IracManager
Checks if the key is present.A key is present as long as its latest update was not confirmed by all remote sites.
- Specified by:
containsKey
in interfaceIracManager
- Parameters:
key
- The key to check.- Returns:
true
if the key is present.
-
-