Hello!

I have tried to reimplement the WordCount example [1].
Since the *cleanup* method is not guaranteed and not executed on a cluster
[2], I tried to use a *TimerTask* which should print out the wordcount
stats.

But the inner class implementation of the *TimerTask* [3] is not able to
see the updated *HashMap* values from the *execute* method.
The output of the *TimerTask* looks as follows:

storm jar WordCount.jar
at.illecker.storm.examples.wordcount.WordCountTopology
253  [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
458  [main] INFO  backtype.storm.StormSubmitter - Jar not uploaded to
master yet. Submitting jar...
462  [main] INFO  backtype.storm.StormSubmitter - Uploading topology jar
WordCount.jar to assigned location:
storm-local/nimbus/inbox/stormjar-e74db7f7-098b-4757-b11d-55f3ed6d0d86.jar
468  [main] INFO  backtype.storm.StormSubmitter - Successfully uploaded
topology jar to assigned location:
storm-local/nimbus/inbox/stormjar-e74db7f7-098b-4757-b11d-55f3ed6d0d86.jar
468  [main] INFO  backtype.storm.StormSubmitter - Submitting topology
word-count-topology in distributed mode with conf {}
500  [main] INFO  backtype.storm.StormSubmitter - Finished submitting
topology: word-count-topology
To kill the topology run: storm kill word-count-topology
1251 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
2255 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
3259 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
4263 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
5265 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0
6267 [Timer-0] INFO
 at.illecker.storm.examples.wordcount.ReportWordCountBolt - WordCounts: 0

I'm sure the tuples are added into the *HashMap* but the *TimerTask* thread
does not see it.
How can I solve this under Storm?
(e.g., a monitoring thread which prints out statistics within a single bolt
with globalGrouping)

Thanks for your help!

Martin

[1] https://github.com/millecker/storm-apps/tree/master/wordcount
[2] https://groups.google.com/forum/#!topic/storm-user/GntJmOZZn4M
[3]
https://github.com/millecker/storm-apps/blob/master/wordcount/src/at/illecker/storm/examples/wordcount/ReportWordCountBolt.java#L68-83
[4]
https://github.com/millecker/storm-apps/blob/master/wordcount/src/at/illecker/storm/examples/wordcount/ReportWordCountBolt.java#L63


$ git clone https://github.com/millecker/storm-apps.git
$ cd storm-apps/wordcount/
$ ant run-cpu

Reply via email to