private boolean isOwnedPartition(Data dataKey) { int partitionId = partitionService.getPartitionId(dataKey); return partitionService.getPartition(partitionId, false).isLocal(); }
@Override public Boolean apply(Integer partitionId, Integer replicaIndex) { IPartition partition = partitionService.getPartition(partitionId); return partition.getReplicaAddress(replicaIndex) != null; } };
private boolean isOwnedPartition(Data dataKey) { int partitionId = partitionService.getPartitionId(dataKey); return partitionService.getPartition(partitionId, false).isLocal(); }
@Override public Boolean apply(Integer partitionId, Integer replicaIndex) { IPartition partition = partitionService.getPartition(partitionId); return partition.getReplicaAddress(replicaIndex) != null; } };
private Data readBackupDataOrNull(Data key) { int partitionId = partitionService.getPartitionId(key); IPartition partition = partitionService.getPartition(partitionId, false); if (!partition.isOwnerOrBackup(thisAddress)) { return null; } PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId); RecordStore recordStore = partitionContainer.getExistingRecordStore(name); if (recordStore == null) { return null; } return recordStore.readBackupData(key); }
protected boolean isBackup(RecordStore recordStore) { int partitionId = recordStore.getPartitionId(); IPartition partition = partitionService.getPartition(partitionId, false); return !partition.isLocal(); }
protected boolean isBackup(RecordStore recordStore) { int partitionId = recordStore.getPartitionId(); IPartition partition = partitionService.getPartition(partitionId, false); return !partition.isLocal(); }
/** * Gets replica address. Waits if necessary. * * @see #waitForReplicaAddress */ private Address getReplicaAddress(int partitionId, int replicaNumber, int backupCount) { IPartition partition = partitionService.getPartition(partitionId); Address replicaAddress = partition.getReplicaAddress(replicaNumber); if (replicaAddress == null) { replicaAddress = waitForReplicaAddress(replicaNumber, partition, backupCount); } return replicaAddress; }
/** * Gets replica address. Waits if necessary. * * @see #waitForReplicaAddress */ private Address getReplicaAddress(int partitionId, int replicaNumber, int backupCount) { IPartition partition = partitionService.getPartition(partitionId); Address replicaAddress = partition.getReplicaAddress(replicaNumber); if (replicaAddress == null) { replicaAddress = waitForReplicaAddress(replicaNumber, partition, backupCount); } return replicaAddress; }
@Override public boolean shouldBackup() { final NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal() && Boolean.TRUE.equals(response); }
@Override public boolean shouldBackup() { final NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal() && Boolean.TRUE.equals(response); }
@Override public boolean shouldBackup() { final NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal() && Boolean.TRUE.equals(response); }
@Override public boolean shouldBackup() { final NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal() && Boolean.TRUE.equals(response); }
private boolean isPrimary() { final Address owner = nodeEngine.getPartitionService().getPartition(partitionId, false).getOwnerOrNull(); final Address thisAddress = nodeEngine.getThisAddress(); return owner != null && owner.equals(thisAddress); }
private boolean isLocal() { NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal(); }
private boolean isPrimary() { final Address owner = nodeEngine.getPartitionService().getPartition(partitionId, false).getOwnerOrNull(); final Address thisAddress = nodeEngine.getThisAddress(); return owner != null && owner.equals(thisAddress); }
private boolean isLocal() { NodeEngine nodeEngine = getNodeEngine(); IPartitionService partitionService = nodeEngine.getPartitionService(); IPartition partition = partitionService.getPartition(getPartitionId()); return partition.isLocal(); }
protected boolean isOwnerOrBackup(int partitionId) { final NodeEngine nodeEngine = mapServiceContext.getNodeEngine(); final IPartitionService partitionService = nodeEngine.getPartitionService(); final IPartition partition = partitionService.getPartition(partitionId, false); final Address thisAddress = nodeEngine.getThisAddress(); return partition.isOwnerOrBackup(thisAddress); } }
private void updateMapOnDemandStats(String mapName, LocalMapOnDemandCalculatedStats onDemandStats) { PartitionContainer[] partitionContainers = mapServiceContext.getPartitionContainers(); for (PartitionContainer partitionContainer : partitionContainers) { IPartition partition = partitionService.getPartition(partitionContainer.getPartitionId()); if (partition.isLocal()) { addPrimaryStatsOf(partitionContainer.getExistingRecordStore(mapName), onDemandStats); } else { addReplicaStatsOf(partitionContainer.getExistingRecordStore(mapName), onDemandStats); } } addStructureStats(mapName, onDemandStats); }
private void updateMapOnDemandStats(String mapName, LocalMapOnDemandCalculatedStats onDemandStats) { PartitionContainer[] partitionContainers = mapServiceContext.getPartitionContainers(); for (PartitionContainer partitionContainer : partitionContainers) { IPartition partition = partitionService.getPartition(partitionContainer.getPartitionId()); if (partition.isLocal()) { addPrimaryStatsOf(partitionContainer.getExistingRecordStore(mapName), onDemandStats); } else { addReplicaStatsOf(partitionContainer.getExistingRecordStore(mapName), onDemandStats); } } addStructureStats(mapName, onDemandStats); }