Class DefaultIracTombstoneManager
- java.lang.Object
-
- org.infinispan.container.versioning.irac.DefaultIracTombstoneManager
-
- All Implemented Interfaces:
IracTombstoneManager
public class DefaultIracTombstoneManager extends Object implements IracTombstoneManager
A default implementation forIracTombstoneManager
.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
Constructors Constructor Description DefaultIracTombstoneManager(Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkStaleTombstone(Collection<? extends IracTombstoneInfo> tombstones)
It receives aCollection
ofIracTombstoneInfo
and sendsIracTombstoneCleanupCommand
for the tombstone no longer valid.boolean
contains(IracTombstoneInfo tombstone)
long
getCurrentDelayMillis()
IracMetadata
getTombstone(Object key)
Returns the tombstone associated to thekey
ornull
if it doesn't exist.boolean
isEmpty()
boolean
isTaskRunning()
void
removeTombstone(Object key)
Removes the tombstone forkey
.void
removeTombstone(IracTombstoneInfo tombstone)
Removes the tombstone if it matches.void
runCleanupAndWait()
void
sendStateTo(Address requestor, IntSet segments)
Sends the tombstone belonging to the segments insegment
to theoriginator
int
size()
void
start()
void
startCleanupTombstone()
void
stop()
void
stopCleanupTask()
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 Detail
-
DefaultIracTombstoneManager
public DefaultIracTombstoneManager(Configuration configuration)
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
stopCleanupTask
public void stopCleanupTask()
-
storeTombstone
public void storeTombstone(int segment, Object key, IracMetadata metadata)
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
public void storeTombstoneIfAbsent(IracTombstoneInfo tombstone)
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
public IracMetadata getTombstone(Object key)
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
public void removeTombstone(IracTombstoneInfo tombstone)
Description copied from interface:IracTombstoneManager
Removes the tombstone if it matches.- Specified by:
removeTombstone
in interfaceIracTombstoneManager
- Parameters:
tombstone
- TheIracTombstoneInfo
.
-
removeTombstone
public void removeTombstone(Object key)
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
public void sendStateTo(Address requestor, IntSet segments)
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
public void checkStaleTombstone(Collection<? extends IracTombstoneInfo> tombstones)
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
public boolean contains(IracTombstoneInfo tombstone)
-
-