private List<IPartition> unregisterPartitions(JobId jobId) { final List<IPartition> unregisteredPartitions = new ArrayList<>(); for (Iterator<Map.Entry<PartitionId, List<IPartition>>> i = availablePartitionMap.entrySet().iterator(); i .hasNext();) { Map.Entry<PartitionId, List<IPartition>> entry = i.next(); PartitionId pid = entry.getKey(); if (jobId.equals(pid.getJobId())) { unregisteredPartitions.addAll(entry.getValue()); i.remove(); } } return unregisteredPartitions; }
private List<NetworkOutputChannel> removePendingRequests(JobId jobId, JobStatus status) { if (status != JobStatus.FAILURE) { return Collections.emptyList(); } final List<NetworkOutputChannel> pendingRequests = new ArrayList<>(); final Iterator<Map.Entry<PartitionId, NetworkOutputChannel>> requestsIterator = partitionRequests.entrySet().iterator(); while (requestsIterator.hasNext()) { final Map.Entry<PartitionId, NetworkOutputChannel> entry = requestsIterator.next(); final PartitionId partitionId = entry.getKey(); if (partitionId.getJobId().equals(jobId)) { pendingRequests.add(entry.getValue()); requestsIterator.remove(); } } return pendingRequests; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResultSetPartitionId other = (ResultSetPartitionId) obj; if (resultSetId == null) { if (other.resultSetId != null) return false; } else if (!resultSetId.equals(other.resultSetId)) return false; if (jobId == null) { if (other.jobId != null) return false; } else if (!jobId.equals(other.jobId)) return false; if (partition != other.partition) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PartitionId other = (PartitionId) obj; if (cdId == null) { if (other.cdId != null) return false; } else if (!cdId.equals(other.cdId)) return false; if (jobId == null) { if (other.jobId != null) return false; } else if (!jobId.equals(other.jobId)) return false; if (receiverIndex != other.receiverIndex) return false; if (senderIndex != other.senderIndex) return false; return true; }