Not sure if there's a "built-in" approach in Storm for doint that. After make sure there isn't, I'd do the following

 * I'd start such long task asynchronously in the prepare method and
   I'd register a callback
 * if the execute method logic depends on the completion of such task,
   I'd use a basic state pattern with two states ON/OFF (where the off
   state is basically a NullObject). The callback would be responsible
   to switch  the bolt state from OFF (initial state) to ON (working state)

Best,
Andrea

On 23/08/16 09:12, Xiang Wang wrote:
Hi All,

I am trying to do some long-time initialisation task in bolt prepare() method in local mode.

I always got error like this:
*WARN o.a.s.s.o.a.z.s.p.FileTxnLog - fsync-ing the write ahead log in SyncThread:0 took 1197ms which will adversely effect operation latency. See the ZooKeeper troubleshooting guide*

And then the task fails.

Could anyone tell me how to fix this problem? Or is it a good practice to run long-time task in prepare() method? If not, what is supposed to be the correct way to do it?

Many thanks for your kind help.

Best,
Xiang
-------------------------------
Xiang Wang, PhD Candidate
Database Research Group
School of Computer Science and Engineering
The University of New South Wales
SYDNEY, AUSTRALIA

Reply via email to