Skip to content

Commit

Permalink
use try with resources
Browse files Browse the repository at this point in the history
Signed-off-by: Sooraj Sinha <[email protected]>
  • Loading branch information
soosinha committed Jun 16, 2024
1 parent 48205b6 commit f2ae040
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public DiffableUtils.MapDiff<String, ClusterState.Custom, Map<String, ClusterSta
);
}
if (firstUploadForEphemeralMetadata) {
// For first split global metadata upload, we want to upload all customs
// For first upload of ephemeral metadata, we want to upload all customs
return DiffableUtils.diff(
Collections.emptyMap(),
clusterState.customs(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public RemoteClusterStateManifestInfo writeIncrementalMetadata(
assert previousClusterState.metadata().coordinationMetadata().term() == clusterState.metadata().coordinationMetadata().term();

boolean firstUploadForSplitGlobalMetadata = !previousManifest.hasMetadataAttributesFiles();
boolean firstUploadForEphemeralMetadata = previousManifest.getDiscoveryNodesMetadata() != null;
boolean firstUploadForEphemeralMetadata = previousManifest.getDiscoveryNodesMetadata() == null;

final DiffableUtils.MapDiff<String, Metadata.Custom, Map<String, Metadata.Custom>> customsDiff = remoteGlobalMetadataManager
.getCustomsDiff(clusterState, previousClusterState, firstUploadForSplitGlobalMetadata, isPublicationEnabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public void writeAsync(final U entity, final ActionListener<Void> listener) {
public T read(final U entity) throws IOException {
// TODO Add timing logs and tracing
assert entity.getFullBlobName() != null;
return entity.deserialize(transferService.downloadBlob(getBlobPathForDownload(entity), entity.getBlobFileName()));
try (InputStream inputStream = transferService.downloadBlob(getBlobPathForDownload(entity), entity.getBlobFileName())) {
return entity.deserialize(inputStream);
}
}

@Override
Expand Down

0 comments on commit f2ae040

Please sign in to comment.