From 00a748d24a565bce0cc8cfa2bdcf165778cea395 Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Mon, 9 Feb 2015 17:20:25 -0800 Subject: [PATCH] YARN-3155. Refactor the exception handling code for TimelineClientImpl's retryOn method (Li Lu via wangda) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../yarn/client/api/impl/TimelineClientImpl.java | 15 +-------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 634a0e7425..2f0ef7a481 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -255,6 +255,9 @@ Release 2.7.0 - UNRELEASED YARN-3144. Configuration for making delegation token failures to timeline server not-fatal (Jonathan Eagles via jlowe) + YARN-3155. Refactor the exception handling code for TimelineClientImpl's + retryOn method (Li Lu via wangda) + OPTIMIZATIONS YARN-2990. FairScheduler's delay-scheduling always waits for node-local and diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java index 0b88632805..af684929e1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java @@ -178,20 +178,7 @@ public Object retryOn(TimelineClientRetryOp op) try { // try perform the op, if fail, keep retrying return op.run(); - } catch (IOException e) { - // We may only throw runtime and IO exceptions. After switching to - // Java 1.7, we can merge these two catch blocks into one. - - // break if there's no retries left - if (leftRetries == 0) { - break; - } - if (op.shouldRetryOn(e)) { - logException(e, leftRetries); - } else { - throw e; - } - } catch (RuntimeException e) { + } catch (IOException | RuntimeException e) { // break if there's no retries left if (leftRetries == 0) { break;