use of com.hazelcast.multimap.impl.operations.MultiMapReplicationOperation in project hazelcast by hazelcast.
the class MultiMapDataSerializerHook method createFactory.
public DataSerializableFactory createFactory() {
ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[PUT_ALL_PARTITION_AWARE_FACTORY + 1];
constructors[CLEAR_BACKUP] = arg -> new ClearBackupOperation();
constructors[CLEAR] = arg -> new ClearOperation();
constructors[CONTAINS_ENTRY] = arg -> new ContainsEntryOperation();
constructors[COUNT] = arg -> new CountOperation();
constructors[ENTRY_SET] = arg -> new EntrySetOperation();
constructors[GET_ALL] = arg -> new GetAllOperation();
constructors[KEY_SET] = arg -> new KeySetOperation();
constructors[PUT_BACKUP] = arg -> new PutBackupOperation();
constructors[PUT] = arg -> new PutOperation();
constructors[REMOVE_ALL_BACKUP] = arg -> new RemoveAllBackupOperation();
constructors[REMOVE_ALL] = arg -> new RemoveAllOperation();
constructors[REMOVE_BACKUP] = arg -> new RemoveBackupOperation();
constructors[REMOVE] = arg -> new RemoveOperation();
constructors[SIZE] = arg -> new SizeOperation();
constructors[VALUES] = arg -> new ValuesOperation();
constructors[TXN_COMMIT_BACKUP] = arg -> new TxnCommitBackupOperation();
constructors[TXN_COMMIT] = arg -> new TxnCommitOperation();
constructors[TXN_GENERATE_RECORD_ID] = arg -> new TxnGenerateRecordIdOperation();
constructors[TXN_LOCK_AND_GET] = arg -> new TxnLockAndGetOperation();
constructors[TXN_PREPARE_BACKUP] = arg -> new TxnPrepareBackupOperation();
constructors[TXN_PREPARE] = arg -> new TxnPrepareOperation();
constructors[TXN_PUT] = arg -> new TxnPutOperation();
constructors[TXN_PUT_BACKUP] = arg -> new TxnPutBackupOperation();
constructors[TXN_REMOVE] = arg -> new TxnRemoveOperation();
constructors[TXN_REMOVE_BACKUP] = arg -> new TxnRemoveBackupOperation();
constructors[TXN_REMOVE_ALL] = arg -> new TxnRemoveAllOperation();
constructors[TXN_REMOVE_ALL_BACKUP] = arg -> new TxnRemoveAllBackupOperation();
constructors[TXN_ROLLBACK_BACKUP] = arg -> new TxnRollbackBackupOperation();
constructors[TXN_ROLLBACK] = arg -> new TxnRollbackOperation();
constructors[MULTIMAP_OP_FACTORY] = arg -> new MultiMapOperationFactory();
constructors[MULTIMAP_TRANSACTION_LOG_RECORD] = arg -> new MultiMapTransactionLogRecord();
constructors[MULTIMAP_EVENT_FILTER] = arg -> new MultiMapEventFilter();
constructors[MULTIMAP_RECORD] = arg -> new MultiMapRecord();
constructors[MULTIMAP_REPLICATION_OPERATION] = arg -> new MultiMapReplicationOperation();
constructors[MULTIMAP_RESPONSE] = arg -> new MultiMapResponse();
constructors[ENTRY_SET_RESPONSE] = arg -> new EntrySetResponse();
constructors[MERGE_CONTAINER] = arg -> new MultiMapMergeContainer();
constructors[MERGE_OPERATION] = arg -> new MergeOperation();
constructors[MERGE_BACKUP_OPERATION] = arg -> new MergeBackupOperation();
constructors[DELETE] = arg -> new DeleteOperation();
constructors[DELETE_BACKUP] = arg -> new DeleteBackupOperation();
constructors[PUT_ALL] = arg -> new PutAllOperation();
constructors[PUT_ALL_BACKUP] = arg -> new PutAllBackupOperation();
constructors[PUT_ALL_PARTITION_AWARE_FACTORY] = arg -> new MultiMapPutAllOperationFactory();
return new ArrayDataSerializableFactory(constructors);
}
use of com.hazelcast.multimap.impl.operations.MultiMapReplicationOperation in project hazelcast by hazelcast.
the class MultiMapService method prepareReplicationOperation.
@Override
public Operation prepareReplicationOperation(PartitionReplicationEvent event, Collection<ServiceNamespace> namespaces) {
if (namespaces.isEmpty()) {
return null;
}
MultiMapPartitionContainer partitionContainer = partitionContainers[event.getPartitionId()];
int replicaIndex = event.getReplicaIndex();
Map<String, Map<Data, MultiMapValue>> map = createHashMap(namespaces.size());
for (ServiceNamespace namespace : namespaces) {
assert isKnownServiceNamespace(namespace) : namespace + " is not a MultiMapService namespace!";
ObjectNamespace ns = (ObjectNamespace) namespace;
MultiMapContainer container = partitionContainer.containerMap.get(ns.getObjectName());
if (container == null) {
continue;
}
if (container.getConfig().getTotalBackupCount() < replicaIndex) {
continue;
}
map.put(ns.getObjectName(), container.getMultiMapValues());
}
return map.isEmpty() ? null : new MultiMapReplicationOperation(map).setServiceName(MultiMapService.SERVICE_NAME).setNodeEngine(nodeEngine);
}
Aggregations