use of com.hazelcast.replicatedmap.impl.PartitionContainer in project hazelcast by hazelcast.
the class RequestMapDataOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
int partitionId = getPartitionId();
Address callerAddress = getCallerAddress();
if (logger.isFineEnabled()) {
logger.fine("Caller { " + callerAddress + " } requested copy of map: " + name + " partitionId=" + partitionId);
}
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(partitionId);
ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
store.setLoaded(true);
if (getNodeEngine().getThisAddress().equals(callerAddress)) {
return;
}
long version = store.getVersion();
Set<RecordMigrationInfo> recordSet = getRecordSet(store);
SyncReplicatedMapDataOperation op = new SyncReplicatedMapDataOperation(name, recordSet, version);
op.setPartitionId(partitionId);
op.setValidateTarget(false);
OperationService operationService = getNodeEngine().getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
use of com.hazelcast.replicatedmap.impl.PartitionContainer in project hazelcast by hazelcast.
the class CheckReplicaVersionOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
int partitionId = getPartitionId();
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(getPartitionId());
ConcurrentMap<String, ReplicatedRecordStore> stores = container.getStores();
for (Map.Entry<String, Long> entry : versions.entrySet()) {
String name = entry.getKey();
Long version = entry.getValue();
ReplicatedRecordStore store = stores.get(name);
if (store == null) {
if (logger.isFineEnabled()) {
logger.fine("Missing store on the replica ! map: " + name + " owner version:" + version + " partitionId=" + partitionId);
}
requestDataFromOwner(name);
} else if (store.isStale(version)) {
if (logger.isFineEnabled()) {
logger.fine("Stale replica! map: " + name + " owner version: " + version + " replica version: " + store.getVersion() + " partitionId=" + partitionId);
}
requestDataFromOwner(name);
}
}
}
Aggregations