Skip to content

Commit

Permalink
HDDS-11181. Cleanup of unnecessary try-catch blocks (#7210)
Browse files Browse the repository at this point in the history
  • Loading branch information
nandakumar131 authored Sep 17, 2024
1 parent 88dd436 commit c365aa0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2117,12 +2117,8 @@ public OzoneFileStatus getFileStatus(OmKeyArgs args) throws IOException {
.setGetFileStatusRequest(req)
.build();

final GetFileStatusResponse resp;
try {
resp = handleError(submitRequest(omRequest)).getGetFileStatusResponse();
} catch (IOException e) {
throw e;
}
final GetFileStatusResponse resp = handleError(submitRequest(omRequest))
.getGetFileStatusResponse();
return OzoneFileStatus.getFromProtobuf(resp.getStatus());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,8 @@ private static OmBucketInfo resolveBucketInfoLink(
* buck-src has the actual BucketLayout that will be used by the
* links.
*/
try {
return resolveBucketInfoLink(metadataManager,
buckInfo.getSourceVolume(), buckInfo.getSourceBucket(), visited);
} catch (IOException e) {
throw e;
}
return resolveBucketInfoLink(metadataManager, buckInfo.getSourceVolume(),
buckInfo.getSourceBucket(), visited);
}
return buckInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ private void setCertificate(String omServiceID,
}
} catch (CertificateException ce) {
throw new IOException(ce);
} catch (IOException e) {
throw e;
} finally {
if (certClient != null) {
certClient.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,7 @@ public Void call() throws Exception {
// wait until all keys are added or exception occurred.
while ((numberOfKeysAdded.get() != totalKeyCount)
&& exception == null) {
try {
Thread.sleep(CHECK_INTERVAL_MILLIS);
} catch (InterruptedException e) {
throw e;
}
Thread.sleep(CHECK_INTERVAL_MILLIS);
}
executor.shutdown();
executor.awaitTermination(Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
Expand All @@ -373,11 +369,7 @@ public Void call() throws Exception {

if (validateExecutor != null) {
while (!validationQueue.isEmpty()) {
try {
Thread.sleep(CHECK_INTERVAL_MILLIS);
} catch (InterruptedException e) {
throw e;
}
Thread.sleep(CHECK_INTERVAL_MILLIS);
}
validateExecutor.shutdown();
validateExecutor.awaitTermination(Integer.MAX_VALUE,
Expand Down Expand Up @@ -421,11 +413,7 @@ private void doCleanObjects() throws InterruptedException {
// wait until all Buckets are cleaned or exception occurred.
while ((numberOfBucketsCleaned.get() != totalBucketCount)
&& exception == null) {
try {
Thread.sleep(CHECK_INTERVAL_MILLIS);
} catch (InterruptedException e) {
throw e;
}
Thread.sleep(CHECK_INTERVAL_MILLIS);
}
} catch (InterruptedException e) {
LOG.error("Failed to wait until all Buckets are cleaned", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,7 @@ private void doCleanBuckets() throws InterruptedException {
// wait until all Buckets are cleaned or exception occurred.
while (numberOfBucketsCleaned.get() != totalBucketCount
&& exception == null) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
throw e;
}
Thread.sleep(100);
}
} catch (InterruptedException e) {
LOG.error("Failed to wait until all Buckets are cleaned", e);
Expand Down

0 comments on commit c365aa0

Please sign in to comment.