Your main() code can run on any host; the computer it's running on doesn't even have to be in the storm cluster at all. When you serialize the "bolt" in the main code it has no information about the state of the bolt that is running on the cluster. As Klausen said, you need to sync the data in the bolt code to some external data store, and then if necessary read it in the "prepare" method when starting the bolt up again.
On Fri, Jan 17, 2014 at 7:18 AM, Aniket Alhat <[email protected]>wrote: > Thanks for reply I am able to restore the serialized object but the > Hashmap in wordcounter.java "counters" returns null when I try to access it > after de-serialization > Can you check that thing? > On Jan 17, 2014 5:04 PM, "Klausen Schaefersinho" < > [email protected]> wrote: > >> Hi, you could try to sync to some remote datebase. Off course this is >> somehow slow, maybe batching could help. In another thread someone >> discussed using Cassandra with some partition tricks... Cheers >> Am 17.01.2014 11:32 schrieb "Aniket Alhat" <[email protected]>: >> >>> Hello, >>> I want to periodically serialize the state of a bolt and remember what >>> tuples it has processed up until particular point. Then when you restart >>> the Bolt you can deserialize that state into the new bolt instance and >>> replay/*process* the tuples from where it was last. >>> >>> Consider the WordCount Topology, I want to store the WordCounter.java >>> bolt state for which I wrote following code in TopologyMain.java >>> >>> TopologyMain.java *http://pastebin.com/suyL4dSB >>> <http://pastebin.com/suyL4dSB>* >>> WordCouter.java *http://pastebin.com/pzEgXCgx >>> <http://pastebin.com/pzEgXCgx>* >>> >>> Now when ever I de-serialize the object back, The HashMap in WordCouter >>> bolt behaves like it has nothing stored in it and starts again as normal >>> bolt rather it should re-count the words but HashMap remains NULL >>> >>> *Whether should I write serialization logic any where else ?* >>> -- >>> >>> *Aniket Alhatlinkedin.com/in/aniketalhat >>> <http://linkedin.com/in/aniketalhat>* >>> *+91 976 603 9317 <%2B91%20976%20603%209317>* >>> >>
