private boolean isLocalPartition(int partitionId) { return partitionService.isPartitionOwner(partitionId); }
private boolean isLocalPartition(int partitionId) { return partitionService.isPartitionOwner(partitionId); }
private boolean isOwn(Data key) { int partitionId = partitionService.getPartitionId(key); return partitionService.isPartitionOwner(partitionId); }
private boolean isOwn(Data key) { int partitionId = partitionService.getPartitionId(key); return partitionService.isPartitionOwner(partitionId); }
public boolean isLocalKey(Object key) { int partId = nodeEngine.getPartitionService().getPartitionId(key); return nodeEngine.getPartitionService().isPartitionOwner(partId); }
public boolean populateSchema(boolean overrideExisting) { clearLoadStats(); allowPopulation = true; startTime.set(nodeEngine.getClusterService().getClusterTime()); int partId = nodeEngine.getPartitionService().getPartitionId(CN_XDM_DOCUMENT); if (nodeEngine.getPartitionService().isPartitionOwner(partId)) { // don't load transactions if schema non-transactional? xtxCache.loadAll(false); logger.info("populateSchema; transactions size after loadAll: {}", xtxCache.size()); xddCache.loadAll(overrideExisting); logger.info("populateSchema; documents size after loadAll: {}", xddCache.size()); stopTime.set(nodeEngine.getClusterService().getClusterTime()); return true; } return false; }
/** * Calculates and returns the role for the map key loader on this partition */ private Role calculateRole() { boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId); boolean isMapNamePartition = partitionId == mapNamePartition; boolean isMapNamePartitionFirstReplica = false; if (hasBackup && isMapNamePartition) { IPartition partition = partitionService.getPartition(partitionId); Address firstReplicaAddress = partition.getReplicaAddress(1); Member member = clusterService.getMember(firstReplicaAddress); if (member != null) { isMapNamePartitionFirstReplica = member.localMember(); } } return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica); }
/** * Calculates and returns the role for the map key loader on this partition */ private Role calculateRole() { boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId); boolean isMapNamePartition = partitionId == mapNamePartition; boolean isMapNamePartitionFirstReplica = false; if (hasBackup && isMapNamePartition) { IPartition partition = partitionService.getPartition(partitionId); Address firstReplicaAddress = partition.getReplicaAddress(1); Member member = clusterService.getMember(firstReplicaAddress); if (member != null) { isMapNamePartitionFirstReplica = member.localMember(); } } return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica); }
public <T> T getCachedObject(String cacheName, Object key, boolean convert) { Data dKey = nodeEngine.toData(key); int partId = nodeEngine.getPartitionService().getPartitionId(dKey); boolean isLocal = nodeEngine.getPartitionService().isPartitionOwner(partId); logger.trace("getCachedObject; partition {} is {}local for key {} on cache {}", partId, isLocal ? "" : "not ", key, cacheName); if (isLocal) { RecordStore<?> cache = getRecordStore(partId, cacheName); if (cache == null) { // nothing stored in this partition yet return null; } Object data = cache.get(dKey, false, nodeEngine.getThisAddress()); if (data != null && convert) { data = nodeEngine.toObject(data); } return (T) data; } return null; }
/** * This method is called directly by user threads, in other words * it is called outside of the partition threads. */ @Override public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { // set last access time to prevent // premature removal of the entry because // of idleness based expiry record.setLastAccessTime(Clock.currentTimeMillis()); } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); // this serialization step is needed not to expose the object, see issue 1292 return mapServiceContext.toData(value); }
/** * This method is called directly by user threads, in other words * it is called outside of the partition threads. */ @Override public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { // set last access time to prevent // premature removal of the entry because // of idleness based expiry record.setLastAccessTime(Clock.currentTimeMillis()); } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); // this serialization step is needed not to expose the object, see issue 1292 return mapServiceContext.toData(value); }
private void executeNotifyOperation(Sequence flushSequence) { if (!flushSequence.isFullFlush() || !nodeEngine.getPartitionService().isPartitionOwner(partitionId)) { return; } Operation operation = new NotifyMapFlushOperation(mapName, flushSequence.getSequence()); operation.setServiceName(SERVICE_NAME) .setNodeEngine(nodeEngine) .setPartitionId(partitionId) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setOperationResponseHandler(createEmptyResponseHandler()); operationService.execute(operation); }
private void executeNotifyOperation(Sequence flushSequence) { if (!flushSequence.isFullFlush() || !nodeEngine.getPartitionService().isPartitionOwner(partitionId)) { return; } Operation operation = new NotifyMapFlushOperation(mapName, flushSequence.getSequence()); operation.setServiceName(SERVICE_NAME) .setNodeEngine(nodeEngine) .setPartitionId(partitionId) .setCallerUuid(nodeEngine.getLocalMember().getUuid()) .setOperationResponseHandler(createEmptyResponseHandler()); operationService.execute(operation); }