public class DefaultIracManager extends Object implements IracManager, Runnable
IracManager.
It tracks the keys updated by this site and sends them, periodically, to the configured remote sites.
The primary owner coordinates everything. It sends the updates request to the remote site and coordinates the local site backup owners. After sending the updates to the remote site, it sends a cleanup request to the local site backup owners
The backup owners only keeps a backup list of the tracked keys.
On topology change, the updated keys list is replicate to the new owner(s). Also, if a segment is being transferred (i.e. the primary owner isn't a write and read owner), no updates to the remote site is sent since, most likely, the node doesn't have the most up-to-date value.
| Constructor and Description |
|---|
DefaultIracManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupKey(Object key,
Object lockOwner,
IracMetadata tombstone)
Sets the
key as not changed and remove any tombstone related to it. |
boolean |
isEmpty() |
Stream<?> |
keysFromMods(Stream<WriteCommand> modifications) |
void |
onTopologyUpdate(CacheTopology oldCacheTopology,
CacheTopology newCacheTopology)
Notifies a topology changed.
|
void |
receiveState(Object key,
Object lockOwner,
IracMetadata tombstone)
Receives the state related to the
key. |
void |
requestState(Address origin,
IntSet segments)
Requests the state stored in this instance for the given
segments. |
void |
run() |
void |
sendStateIfNeeded(Address origin,
IntSet segments,
Object key,
Object lockOwner) |
void |
setBackOff(ExponentialBackOff backOff) |
void |
start() |
void |
stop() |
void |
trackClear()
Sets all keys as removed.
|
void |
trackKeysFromTransaction(Stream<WriteCommand> modifications,
GlobalTransaction lockOwner)
Sets all keys affected by the transaction as changed.
|
void |
trackUpdatedKey(Object key,
Object lockOwner)
Sets the
key as changed by the lockOwner. |
<K> void |
trackUpdatedKeys(Collection<K> keys,
Object lockOwner)
Sets all the keys in
keys as changed by the lockOwner. |
public void start()
public void stop()
public void trackUpdatedKey(Object key, Object lockOwner)
IracManagerkey as changed by the lockOwner.trackUpdatedKey in interface IracManagerkey - The key changed.lockOwner - The lock owner who updated the key.public <K> void trackUpdatedKeys(Collection<K> keys, Object lockOwner)
IracManagerkeys as changed by the lockOwner.trackUpdatedKeys in interface IracManagerkeys - A Collection of keys changed.lockOwner - The lock owner who updated the keys.public void trackKeysFromTransaction(Stream<WriteCommand> modifications, GlobalTransaction lockOwner)
IracManagertrackKeysFromTransaction in interface IracManagermodifications - The Stream of modifications made by the transaction.lockOwner - The GlobalTransaction.public void trackClear()
IracManagertrackClear in interface IracManagerpublic void cleanupKey(Object key, Object lockOwner, IracMetadata tombstone)
IracManagerkey as not changed and remove any tombstone related to it.
If lockOwner isn't the last one who updated the key, this method is a no-op.
cleanupKey in interface IracManagerkey - The key.lockOwner - The lock owner who updated the key.tombstone - The tombstone (can be null).public void onTopologyUpdate(CacheTopology oldCacheTopology, CacheTopology newCacheTopology)
IracManageronTopologyUpdate in interface IracManageroldCacheTopology - The old CacheTopology.newCacheTopology - The new CacheTopology.public void requestState(Address origin, IntSet segments)
IracManagersegments.requestState in interface IracManagerorigin - The requestor.segments - The segments requested.public void receiveState(Object key, Object lockOwner, IracMetadata tombstone)
IracManagerkey.receiveState in interface IracManagerkey - The key modified.lockOwner - The last lockOwner.tombstone - The tombstone (can be null)public void sendStateIfNeeded(Address origin, IntSet segments, Object key, Object lockOwner)
public Stream<?> keysFromMods(Stream<WriteCommand> modifications)
public void setBackOff(ExponentialBackOff backOff)
public boolean isEmpty()
Copyright © 2022 JBoss by Red Hat. All rights reserved.