For example:

builder.setBolt("xxx", new XXXBolt(), 10)


Assume that there is only one worker, how many XXXBolt's java object
instance will be there? 1 or 10?


In fact, I did some test by add the following code in the execute method:

LOGGER.debug("BoltID: {}, ThreadID: {} - {}",
System.identityHashCode(this), Thread.currentThread().getName(),
Thread.currentThread().getId());

The result is:

BoltID: 558207946, ThreadID: analyze_bolt:4-BoltExecutors - 107
BoltID: 1052936813, ThreadID: analyze_bolt:5-BoltExecutors - 103

Seems that there is instance for every thread, but can't be sure that will
or not bolt instance will be reused among tasks/threads, and the document
does not make this clear either.


-- 
Dollyn

Reply via email to