This is an automated email from the ASF dual-hosted git repository.
nlu90 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/master by this push:
new bc47197 init instance state only if the topology is stateful and the
component is a stateful component (#3229)
bc47197 is described below
commit bc4719746bf613bc5eaf4c3781a435ceb6349198
Author: Neng Lu <[email protected]>
AuthorDate: Tue Apr 2 14:17:34 2019 -0700
init instance state only if the topology is stateful and the component is a
stateful component (#3229)
---
.../src/java/org/apache/heron/instance/bolt/BoltInstance.java | 4 ++--
.../src/java/org/apache/heron/instance/spout/SpoutInstance.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/heron/instance/src/java/org/apache/heron/instance/bolt/BoltInstance.java
b/heron/instance/src/java/org/apache/heron/instance/bolt/BoltInstance.java
index 893ed01..9cc177a 100644
--- a/heron/instance/src/java/org/apache/heron/instance/bolt/BoltInstance.java
+++ b/heron/instance/src/java/org/apache/heron/instance/bolt/BoltInstance.java
@@ -183,8 +183,8 @@ public class BoltInstance implements IInstance {
boltMetrics.registerMetrics(topologyContext);
- // Initialize the instanceState if the bolt is stateful
- if (bolt instanceof IStatefulComponent) {
+ // Initialize the instanceState if the topology is stateful and bolt is a
stateful component
+ if (isTopologyStateful && bolt instanceof IStatefulComponent) {
this.instanceState = state;
((IStatefulComponent<Serializable, Serializable>)
bolt).initState(instanceState);
diff --git
a/heron/instance/src/java/org/apache/heron/instance/spout/SpoutInstance.java
b/heron/instance/src/java/org/apache/heron/instance/spout/SpoutInstance.java
index 348a641..53675c4 100644
--- a/heron/instance/src/java/org/apache/heron/instance/spout/SpoutInstance.java
+++ b/heron/instance/src/java/org/apache/heron/instance/spout/SpoutInstance.java
@@ -188,8 +188,8 @@ public class SpoutInstance implements IInstance {
spoutMetrics.registerMetrics(topologyContext);
- // Initialize the instanceState if the spout is stateful
- if (spout instanceof IStatefulComponent) {
+ // Initialize the instanceState if the topology is stateful and spout is a
stateful component
+ if (isTopologyStateful && spout instanceof IStatefulComponent) {
this.instanceState = state;
((IStatefulComponent<Serializable, Serializable>)
spout).initState(instanceState);