@Override public int compareTo(StorageLocation obj) { if (obj == this) { return 0; } else if (obj == null) { return -1; } StorageLocation otherStorage = (StorageLocation) obj; if (this.getNormalizedUri() != null && otherStorage.getNormalizedUri() != null) { return this.getNormalizedUri().compareTo( otherStorage.getNormalizedUri()); } else if (this.getNormalizedUri() == null && otherStorage.getNormalizedUri() == null) { return this.storageType.compareTo(otherStorage.getStorageType()); } else if (this.getNormalizedUri() == null) { return -1; } else { return 1; } }
@Override // FSDatasetMBean public String[] getFailedStorageLocations() { VolumeFailureInfo[] infos = volumes.getVolumeFailureInfos(); List<String> failedStorageLocations = Lists.newArrayListWithCapacity( infos.length); for (VolumeFailureInfo info: infos) { failedStorageLocations.add( info.getFailedStorageLocation().getNormalizedUri().toString()); } return failedStorageLocations.toArray( new String[failedStorageLocations.size()]); }
@Override // FsDatasetSpi public VolumeFailureSummary getVolumeFailureSummary() { VolumeFailureInfo[] infos = volumes.getVolumeFailureInfos(); if (infos.length == 0) { return null; } List<String> failedStorageLocations = Lists.newArrayListWithCapacity( infos.length); long lastVolumeFailureDate = 0; long estimatedCapacityLostTotal = 0; for (VolumeFailureInfo info: infos) { failedStorageLocations.add( info.getFailedStorageLocation().getNormalizedUri().toString()); long failureDate = info.getFailureDate(); if (failureDate > lastVolumeFailureDate) { lastVolumeFailureDate = failureDate; } estimatedCapacityLostTotal += info.getEstimatedCapacityLost(); } return new VolumeFailureSummary( failedStorageLocations.toArray(new String[failedStorageLocations.size()]), lastVolumeFailureDate, estimatedCapacityLostTotal); }
existingStorageLocations.put(loc.getNormalizedUri().toString(), loc); if (newLocation.matchesStorageDirectory(dir)) { StorageLocation oldLocation = existingStorageLocations.get( newLocation.getNormalizedUri().toString()); if (oldLocation != null && oldLocation.getStorageType() != newLocation.getStorageType()) { results.newLocations.iterator(); newLocationItr.hasNext();) { StorageLocation newLocation = newLocationItr.next(); if (newLocation.getNormalizedUri().toString().equals( failedStorageLocation)) {