Class PartitionHandlingManagerImpl
java.lang.Object
org.infinispan.partitionhandling.impl.PartitionHandlingManagerImpl
- All Implemented Interfaces:
PartitionHandlingManager
- Direct Known Subclasses:
ScatteredPartitionHandlingManagerImpl
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addPartialCommit1PCTransaction
(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys, List<org.infinispan.commands.write.WriteCommand> modifications) Adds a partially committed transaction.boolean
addPartialCommit2PCTransaction
(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys, Map<Object, IncrementableEntryVersion> newVersions) Adds a partially committed transaction.boolean
addPartialRollbackTransaction
(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys) Adds a partially aborted transaction.boolean
canRollbackTransactionAfterOriginatorLeave
(GlobalTransaction globalTransaction) It checks if the transaction can be aborted when the originator leaves the cluster.void
void
void
void
checkWrite
(Object key) protected void
protected PartitionHandling
protected boolean
isKeyOperationAllowed
(boolean isWrite, long flagBitSet, LocalizedCacheTopology cacheTopology, Object key) Check if a read/write operation is allowed with the actual membersboolean
isTransactionPartiallyCommitted
(GlobalTransaction globalTransaction) It checks if the transaction resources (for example locks) can be released.void
onTopologyUpdate
(CacheTopology cacheTopology) Notifies thePartitionHandlingManager
that the cache topology was update.setAvailabilityMode
(AvailabilityMode availabilityMode)
-
Field Details
-
distributionManager
-
-
Constructor Details
-
PartitionHandlingManagerImpl
-
-
Method Details
-
getAvailabilityMode
- Specified by:
getAvailabilityMode
in interfacePartitionHandlingManager
-
setAvailabilityMode
- Specified by:
setAvailabilityMode
in interfacePartitionHandlingManager
-
checkWrite
- Specified by:
checkWrite
in interfacePartitionHandlingManager
-
checkRead
- Specified by:
checkRead
in interfacePartitionHandlingManager
-
checkClear
public void checkClear()- Specified by:
checkClear
in interfacePartitionHandlingManager
-
checkBulkRead
public void checkBulkRead()- Specified by:
checkBulkRead
in interfacePartitionHandlingManager
-
getLastStableTopology
- Specified by:
getLastStableTopology
in interfacePartitionHandlingManager
-
addPartialRollbackTransaction
public boolean addPartialRollbackTransaction(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys) Description copied from interface:PartitionHandlingManager
Adds a partially aborted transaction. The transaction should be registered when it is not sure if the abort happens successfully in all the affected nodes.- Specified by:
addPartialRollbackTransaction
in interfacePartitionHandlingManager
- Parameters:
globalTransaction
- the global transaction.affectedNodes
- the nodes involved in the transaction and they must abort the transaction.lockedKeys
- the keys locally locked.- Returns:
true
if thePartitionHandlingManager
will handle it,false
otherwise.
-
addPartialCommit2PCTransaction
public boolean addPartialCommit2PCTransaction(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys, Map<Object, IncrementableEntryVersion> newVersions) Description copied from interface:PartitionHandlingManager
Adds a partially committed transaction. The transaction is committed in the second phase and it is register if it is not sure that the transaction was committed successfully in all the affected nodes.- Specified by:
addPartialCommit2PCTransaction
in interfacePartitionHandlingManager
- Parameters:
globalTransaction
- the global transaction.affectedNodes
- the nodes involved in the transaction and they must commit it.lockedKeys
- the keys locally locked.newVersions
- the updated versions. Only used when versioning is enabled.- Returns:
true
if thePartitionHandlingManager
will handle it,false
otherwise.
-
addPartialCommit1PCTransaction
public boolean addPartialCommit1PCTransaction(GlobalTransaction globalTransaction, Collection<Address> affectedNodes, Collection<Object> lockedKeys, List<org.infinispan.commands.write.WriteCommand> modifications) Description copied from interface:PartitionHandlingManager
Adds a partially committed transaction. The transaction is committed in one phase and it is register if it is not sure that the transaction was committed successfully in all the affected nodes.- Specified by:
addPartialCommit1PCTransaction
in interfacePartitionHandlingManager
- Parameters:
globalTransaction
- the global transaction.affectedNodes
- the nodes involved in the transaction and they must commit it.lockedKeys
- the keys locally locked.modifications
- the transaction's modification log.- Returns:
true
if thePartitionHandlingManager
will handle it,false
otherwise.
-
isTransactionPartiallyCommitted
Description copied from interface:PartitionHandlingManager
It checks if the transaction resources (for example locks) can be released. The transaction resource can't be released when the transaction is partially committed.- Specified by:
isTransactionPartiallyCommitted
in interfacePartitionHandlingManager
- Parameters:
globalTransaction
- the transaction.- Returns:
true
if the resources can be released,false
otherwise.
-
getPartialTransactions
- Specified by:
getPartialTransactions
in interfacePartitionHandlingManager
- Returns:
- a collection of partial committed or aborted transactions.
-
canRollbackTransactionAfterOriginatorLeave
Description copied from interface:PartitionHandlingManager
It checks if the transaction can be aborted when the originator leaves the cluster. The only case in which it is not possible to abort is when partition handling is enabled and the originator didn't leave gracefully. The transaction will complete when the partition heals.- Specified by:
canRollbackTransactionAfterOriginatorLeave
in interfacePartitionHandlingManager
- Parameters:
globalTransaction
- the global transaction.- Returns:
true
if the transaction can be aborted,false
otherwise.
-
onTopologyUpdate
Description copied from interface:PartitionHandlingManager
Notifies thePartitionHandlingManager
that the cache topology was update. It detects when the partition is merged and tries to complete all the partially completed transactions.- Specified by:
onTopologyUpdate
in interfacePartitionHandlingManager
- Parameters:
cacheTopology
- the new cache topology.
-
doCheck
-
isKeyOperationAllowed
protected boolean isKeyOperationAllowed(boolean isWrite, long flagBitSet, LocalizedCacheTopology cacheTopology, Object key) Check if a read/write operation is allowed with the actual members- Parameters:
isWrite
-false
for reads,true
for writesflagBitSet
- reads with theFlag.FORCE_WRITE_LOCK
are treated as writescacheTopology
- actual members, ornull
for bulk operationskey
- key owners, ornull
for bulk operations- Returns:
true
if the operation is allowed,false
otherwise.
-
getPartitionHandling
-