Package org.infinispan.util.concurrent
Class CommandAckCollector
java.lang.Object
org.infinispan.util.concurrent.CommandAckCollector
An acknowledge collector for Triangle algorithm used in non-transactional caches for write operations.
Acknowledges are used between the owners and the originator. They signal the completion of a write operation. The operation can complete successfully or not.
The acknowledges are valid on the same cache topology id. So, each acknowledge is tagged with the command topology id. Acknowledges from previous topology id are discarded.
The acknowledges from the primary owner carry the return value of the operation.
- Since:
- 9.0
- Author:
- Pedro Ruivo
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Acknowledges a write operation completion in the backup owner.void
completeExceptionally
(long id, Throwable throwable, int topologyId) Acknowledges an exception during the operation execution.<T> org.infinispan.interceptors.distribution.Collector<T>
create
(long id, Collection<Address> backupOwners, int topologyId) Creates a collector for a single key write operation.org.infinispan.interceptors.distribution.BiasedCollector
createBiased
(long id, int topologyId) createMultiTargetCollector
(long id, int primaries, int topologyId) <T> org.infinispan.interceptors.distribution.Collector<T>
createSegmentBasedCollector
(long id, Map<Address, Collection<Integer>> backups, int topologyId) Creates a collector forPutMapCommand
.boolean
hasPendingBackupAcks
(long id) void
multiKeyBackupAck
(long id, Address from, int segment, int topologyId) Acknowledges aPutMapCommand
completion in the backup owner.void
onMembersChange
(Collection<Address> members) Notifies a change in member list.void
start()
-
Constructor Details
-
CommandAckCollector
public CommandAckCollector()
-
-
Method Details
-
start
public void start() -
create
public <T> org.infinispan.interceptors.distribution.Collector<T> create(long id, Collection<Address> backupOwners, int topologyId) Creates a collector for a single key write operation.- Parameters:
id
- the id fromCommandInvocationId
.backupOwners
- the backup owners of the key.topologyId
- the current topology id.
-
createBiased
public org.infinispan.interceptors.distribution.BiasedCollector createBiased(long id, int topologyId) -
createMultiTargetCollector
public CommandAckCollector.MultiTargetCollector createMultiTargetCollector(long id, int primaries, int topologyId) -
createSegmentBasedCollector
public <T> org.infinispan.interceptors.distribution.Collector<T> createSegmentBasedCollector(long id, Map<Address, Collection<Integer>> backups, int topologyId) Creates a collector forPutMapCommand
.- Parameters:
id
- the id fromCommandInvocationId.getId()
.backups
- a map between a backup owner and its segments affected.topologyId
- the current topology id.
-
multiKeyBackupAck
Acknowledges aPutMapCommand
completion in the backup owner.- Parameters:
id
- the id fromCommandInvocationId.getId()
.from
- the backup owner.segment
- the segments affected and acknowledged.topologyId
- the topology id.
-
backupAck
Acknowledges a write operation completion in the backup owner.- Parameters:
id
- the id fromCommandInvocationId.getId()
.from
- the backup owner.topologyId
- the topology id.
-
completeExceptionally
Acknowledges an exception during the operation execution.The collector is completed without waiting any further acknowledges.
- Parameters:
id
- the id fromCommandInvocationId.getId()
.throwable
- theThrowable
.topologyId
- the topology id.
-
getPendingCommands
- Returns:
- the pending ids from
CommandInvocationId.getId()
(testing purposes only)
-
hasPendingBackupAcks
public boolean hasPendingBackupAcks(long id) - Parameters:
id
- the id fromCommandInvocationId.getId()
.- Returns:
true
if there are acknowledges pending from the backup owners,false
otherwise. (testing purposes only)
-
onMembersChange
Notifies a change in member list.- Parameters:
members
- the new cluster members.
-