You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by hu...@apache.org on 2018/08/14 01:33:05 UTC
[incubator-heron] branch huijunw/fiximporthealthmgr updated:
fixstyle
This is an automated email from the ASF dual-hosted git repository.
huijun pushed a commit to branch huijunw/fiximporthealthmgr
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/huijunw/fiximporthealthmgr by this push:
new 6bfb20e fixstyle
6bfb20e is described below
commit 6bfb20e01978cf92f7d5495edef0e55aeb88c03a
Author: Huijun Wu <hu...@twitter.com>
AuthorDate: Mon Aug 13 18:32:39 2018 -0700
fixstyle
---
.../apache/heron/healthmgr/common/InvalidStateException.java | 2 +-
.../apache/heron/healthmgr/common/PhysicalPlanProvider.java | 10 ++++++----
.../org/apache/heron/healthmgr/policy/ToggleablePolicy.java | 3 ++-
.../org/apache/heron/healthmgr/sensors/ExecuteCountSensor.java | 1 -
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/InvalidStateException.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/InvalidStateException.java
index a209d5d..268d551 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/InvalidStateException.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/InvalidStateException.java
@@ -22,7 +22,7 @@ package org.apache.heron.healthmgr.common;
/**
* This exception is generated when desired state information is not found
*/
-class InvalidStateException extends RuntimeException {
+public class InvalidStateException extends RuntimeException {
private static final long serialVersionUID = 1649354922817533118L;
InvalidStateException(String topologyName, String message) {
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/PhysicalPlanProvider.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/PhysicalPlanProvider.java
index a563cd0..3b20524 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/PhysicalPlanProvider.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/common/PhysicalPlanProvider.java
@@ -29,6 +29,8 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
+import com.google.protobuf.InvalidProtocolBufferException;
+
import org.apache.heron.api.generated.TopologyAPI;
import org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan;
import org.apache.heron.proto.tmaster.TopologyMaster;
@@ -64,13 +66,13 @@ public class PhysicalPlanProvider implements Provider<PhysicalPlan> {
// base64 string to proto bytes
byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
// construct proto obj from bytes
- PhysicalPlan physicalPlan = null;
+ PhysicalPlan pp = null;
try {
- physicalPlan = PhysicalPlan.parseFrom(decodedBytes);
- } catch (Exception e) {
+ pp = PhysicalPlan.parseFrom(decodedBytes);
+ } catch (InvalidProtocolBufferException e) {
throw new InvalidStateException(topologyName, "Failed to fetch the physical plan");
}
- return physicalPlan;
+ return pp;
}
@Override
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
index 316d8fa..fee55bd 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/policy/ToggleablePolicy.java
@@ -35,6 +35,7 @@ import com.microsoft.dhalion.policy.HealthPolicyImpl;
import org.apache.heron.api.generated.TopologyAPI;
import org.apache.heron.healthmgr.HealthPolicyConfig;
+import org.apache.heron.healthmgr.common.InvalidStateException;
import org.apache.heron.healthmgr.common.PhysicalPlanProvider;
import static org.apache.heron.healthmgr.HealthPolicyConfig.CONF_POLICY_ID;
@@ -98,7 +99,7 @@ public class ToggleablePolicy extends HealthPolicyImpl {
}
}
}
- } catch (Exception e) {
+ } catch (InvalidStateException e) {
LOG.warning(
"failed to fetch the latest physical plan and skip policy toggle update: "
+ e.toString());
diff --git a/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/ExecuteCountSensor.java b/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/ExecuteCountSensor.java
index d38df4c..95263ef 100644
--- a/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/ExecuteCountSensor.java
+++ b/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/ExecuteCountSensor.java
@@ -20,7 +20,6 @@
package org.apache.heron.healthmgr.sensors;
import java.time.Instant;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;