incubator-s4-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiaan Zeng <l.alle...@gmail.com>
Subject how to maintain state in ProcessElement
Date Wed, 10 Jul 2013 15:30:41 GMT
Hi,

I wonder how to maintain state in ProcessElement. For example,

s4-core/src/test/java/org/apache/s4/wordcount/WordCountPE.java
The variable "int wordCounter;" is used in onEvent() function and is
reset to zero after the onEvent() function finishes. This is
stateless.

s4-core/src/test/java/org/apache/s4/wordcount/WordClassifierPE.java
The variables "private int counter;" and "TreeMap<String, Integer>
counts" are used in onEvent() function to keep total word count and
word count for each word. This is stateful.

I am confused about such behavior of ProcessElement. How do I turn
on/off stateless if there is such option?

Thanks in advance.

--
Regards,
Jiaan

Mime
View raw message