/** {@inheritDoc} */ @Override public GridDhtPartitionState partitionState(UUID nodeId, int part) { lock.readLock().lock(); try { GridDhtPartitionMap partMap = node2part.get(nodeId); if (partMap != null) { GridDhtPartitionState state = partMap.get(part); return state == null ? EVICTED : state; } return EVICTED; } finally { lock.readLock().unlock(); } }
/** * @param p Partition. * @param nodeId Node ID. * @param match State to match. * @param matches Additional states. * @return Filter for owners of this partition. */ private boolean hasState( final int p, @Nullable UUID nodeId, final GridDhtPartitionState match, final GridDhtPartitionState... matches) { if (nodeId == null) return false; GridDhtPartitionMap parts = node2part.get(nodeId); // Set can be null if node has been removed. if (parts != null) { GridDhtPartitionState state = parts.get(p); if (state == match) return true; if (matches != null && matches.length > 0) for (GridDhtPartitionState s : matches) if (state == s) return true; } return false; }