Class DefaultIracTombstoneManager
java.lang.Object
org.infinispan.container.versioning.irac.DefaultIracTombstoneManager
- All Implemented Interfaces:
IracTombstoneManager
A default implementation for
IracTombstoneManager
.
This class is responsible to keep track of the tombstones for the IRAC algorithm. Tombstones are used when a key is removed but its metadata is necessary to detect possible conflicts in this and remote sites. When all sites have updated the key, the tombstone can be removed.
Tombstones are removed periodically in the background.
- Since:
- 14.0
-
Constructor Summary
ConstructorDescriptionDefaultIracTombstoneManager
(Configuration config, Collection<IracXSiteBackup> backups) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkStaleTombstone
(Collection<? extends IracTombstoneInfo> tombstones) It receives aCollection
ofIracTombstoneInfo
and sendsIracTombstoneCleanupCommand
for the tombstone no longer valid.boolean
contains
(IracTombstoneInfo tombstone) long
getTombstone
(Object key) Returns the tombstone associated to thekey
ornull
if it doesn't exist.boolean
isEmpty()
boolean
void
removeTombstone
(Object key) Removes the tombstone forkey
.void
removeTombstone
(IracTombstoneInfo tombstone) Removes the tombstone if it matches.void
void
sendStateTo
(Address requestor, IntSet segments) Sends the tombstone belonging to the segments insegment
to theoriginator
int
size()
void
start()
void
void
stop()
void
void
storeTombstone
(int segment, Object key, IracMetadata metadata) Stores a tombstone for a removed key.void
storeTombstoneIfAbsent
(IracTombstoneInfo tombstone) Same asIracTombstoneManager.storeTombstoneIfAbsent(int, Object, IracMetadata)
but with aIracTombstoneInfo
instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.container.versioning.irac.IracTombstoneManager
storeTombstoneIfAbsent
-
Constructor Details
-
DefaultIracTombstoneManager
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
stopCleanupTask
public void stopCleanupTask() -
storeTombstone
Description copied from interface:IracTombstoneManager
Stores a tombstone for a removed key.It overwrites any previous tombstone associated to the
key
.- Specified by:
storeTombstone
in interfaceIracTombstoneManager
- Parameters:
segment
- The key's segment.key
- The key.metadata
- TheIracMetadata
.
-
storeTombstoneIfAbsent
Description copied from interface:IracTombstoneManager
Same asIracTombstoneManager.storeTombstoneIfAbsent(int, Object, IracMetadata)
but with aIracTombstoneInfo
instance.- Specified by:
storeTombstoneIfAbsent
in interfaceIracTombstoneManager
- Parameters:
tombstone
- The tombstone to store.
-
getTombstone
Description copied from interface:IracTombstoneManager
Returns the tombstone associated to thekey
ornull
if it doesn't exist.- Specified by:
getTombstone
in interfaceIracTombstoneManager
- Parameters:
key
- The key.- Returns:
- The tombstone.
-
removeTombstone
Description copied from interface:IracTombstoneManager
Removes the tombstone if it matches.- Specified by:
removeTombstone
in interfaceIracTombstoneManager
- Parameters:
tombstone
- TheIracTombstoneInfo
.
-
removeTombstone
Description copied from interface:IracTombstoneManager
Removes the tombstone forkey
.- Specified by:
removeTombstone
in interfaceIracTombstoneManager
- Parameters:
key
- The key.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIracTombstoneManager
- Returns:
true
if no tombstones are stored.
-
size
public int size()- Specified by:
size
in interfaceIracTombstoneManager
- Returns:
- the number of tombstones stored.
-
isTaskRunning
public boolean isTaskRunning()- Specified by:
isTaskRunning
in interfaceIracTombstoneManager
- Returns:
true
if the cleanup task is currently running.
-
getCurrentDelayMillis
public long getCurrentDelayMillis()- Specified by:
getCurrentDelayMillis
in interfaceIracTombstoneManager
- Returns:
- The current delay between cleanup task in milliseconds.
-
sendStateTo
Description copied from interface:IracTombstoneManager
Sends the tombstone belonging to the segments insegment
to theoriginator
The sending is done asynchronously, and it does not wait for the sending to complete.
- Specified by:
sendStateTo
in interfaceIracTombstoneManager
- Parameters:
requestor
- The requestorAddress
.segments
- The segments requested.
-
checkStaleTombstone
Description copied from interface:IracTombstoneManager
It receives aCollection
ofIracTombstoneInfo
and sendsIracTombstoneCleanupCommand
for the tombstone no longer valid.- Specified by:
checkStaleTombstone
in interfaceIracTombstoneManager
- Parameters:
tombstones
- TheIracTombstoneInfo
collection.
-
startCleanupTombstone
public void startCleanupTombstone() -
runCleanupAndWait
public void runCleanupAndWait() -
contains
-