use of com.hazelcast.transaction.impl.xa.operations.XaReplicationOperation in project hazelcast by hazelcast.
the class XAService method prepareReplicationOperation.
//Migration related methods
@Override
public Operation prepareReplicationOperation(PartitionReplicationEvent event) {
if (event.getReplicaIndex() > 1) {
return null;
}
List<XATransactionDTO> migrationData = new ArrayList<XATransactionDTO>();
InternalPartitionService partitionService = nodeEngine.getPartitionService();
for (Map.Entry<SerializableXID, List<XATransaction>> entry : transactions.entrySet()) {
SerializableXID xid = entry.getKey();
int partitionId = partitionService.getPartitionId(xid);
List<XATransaction> xaTransactionList = entry.getValue();
for (XATransaction xaTransaction : xaTransactionList) {
if (partitionId == event.getPartitionId()) {
migrationData.add(new XATransactionDTO(xaTransaction));
}
}
}
if (migrationData.isEmpty()) {
return null;
} else {
return new XaReplicationOperation(migrationData, event.getPartitionId(), event.getReplicaIndex());
}
}
Aggregations