/** * {@inheritDoc} * <p> * The method will set the owned partition set in a CAS loop because * this method can be called concurrently. */ @Override public void reloadOwnedPartitions() { final IPartitionService partitionService = nodeEngine.getPartitionService(); for (; ; ) { final Collection<Integer> expected = ownedPartitions.get(); final Collection<Integer> partitions = partitionService.getMemberPartitions(nodeEngine.getThisAddress()); final Set<Integer> newSet = Collections.unmodifiableSet(new LinkedHashSet<Integer>(partitions)); if (ownedPartitions.compareAndSet(expected, newSet)) { return; } } }
/** * {@inheritDoc} * <p> * The method will set the owned partition set in a CAS loop because * this method can be called concurrently. */ @Override public void reloadOwnedPartitions() { final IPartitionService partitionService = nodeEngine.getPartitionService(); for (; ; ) { final Collection<Integer> expected = ownedPartitions.get(); final Collection<Integer> partitions = partitionService.getMemberPartitions(nodeEngine.getThisAddress()); final Set<Integer> newSet = Collections.unmodifiableSet(new LinkedHashSet<Integer>(partitions)); if (ownedPartitions.compareAndSet(expected, newSet)) { return; } } }
private BitSet getLocalPartitionIds() { int partitionCount = partitionService.getPartitionCount(); BitSet partitionIds = new BitSet(partitionCount); BitSetUtils.setBits(partitionIds, partitionService.getMemberPartitions(nodeEngine.getThisAddress())); return partitionIds; }
private BitSet getLocalPartitionIds() { int partitionCount = partitionService.getPartitionCount(); BitSet partitionIds = new BitSet(partitionCount); BitSetUtils.setBits(partitionIds, partitionService.getMemberPartitions(nodeEngine.getThisAddress())); return partitionIds; }
Query q = new Query(CN_XDM_DOCUMENT, query, IterationType.KEY, null, null); List<DocumentKey> results = new ArrayList<>(); List<Integer> parts = nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()); for (Integer partId: parts) { int shift = 0;
public int getUpdatingDocumentCount() { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext xddCtx = svc.getMapServiceContext(); // this does not work for some reason //return xddCtx.getWriteBehindQueueItemCounter().get(); int cnt = 0; List<Integer> parts = nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()); for (int part: parts) { RecordStore rs = xddCtx.getRecordStore(part, CN_XDM_DOCUMENT); if (rs != null) { cnt += rs.getMapDataStore().notFinishedOperationsCount(); } } return cnt; }
Query q = new Query(CN_XDM_DOCUMENT, query, IterationType.VALUE, null, null); List<Document> results = new ArrayList<>(fetchSize); List<Integer> parts = nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()); for (Integer partId: parts) { int shift = 0;
public Collection<PartitionStatistics> getPartitionStatistics() { MapService svc = nodeEngine.getService(MapService.SERVICE_NAME); MapServiceContext mapCtx = svc.getMapServiceContext(); List<Integer> parts = nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()); String address = nodeEngine.getThisAddress().toString(); List<PartitionStatistics> stats = new ArrayList<>(parts.size());
@Override public void run() throws Exception { MapReduceService mapReduceService = getService(); JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId()); if (supervisor == null) { result = new RequestPartitionResult(NO_SUPERVISOR, -1); return; } IPartitionService ps = getNodeEngine().getPartitionService(); List<Integer> memberPartitions = ps.getMemberPartitions(getCallerAddress()); JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation(); while (true) { int selectedPartition = searchMemberPartitionToProcess(processInformation, memberPartitions); if (selectedPartition == -1) { // All partitions seem to be assigned so give up result = new RequestPartitionResult(NO_MORE_PARTITIONS, -1); return; } JobPartitionState.State nextState = stateChange(getCallerAddress(), selectedPartition, WAITING, processInformation, supervisor.getConfiguration()); if (nextState == MAPPING) { result = new RequestPartitionResult(SUCCESSFUL, selectedPartition); return; } } }
@Override public void run() throws Exception { MapReduceService mapReduceService = getService(); JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId()); if (supervisor == null) { result = new RequestPartitionResult(NO_SUPERVISOR, -1); return; } IPartitionService ps = getNodeEngine().getPartitionService(); List<Integer> memberPartitions = ps.getMemberPartitions(getCallerAddress()); JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation(); while (true) { int selectedPartition = searchMemberPartitionToProcess(processInformation, memberPartitions); if (selectedPartition == -1) { // All partitions seem to be assigned so give up result = new RequestPartitionResult(NO_MORE_PARTITIONS, -1); return; } JobPartitionState.State nextState = stateChange(getCallerAddress(), selectedPartition, WAITING, processInformation, supervisor.getConfiguration()); if (nextState == MAPPING) { result = new RequestPartitionResult(SUCCESSFUL, selectedPartition); return; } } }