[storm] Fwd: Storm DB Disconnection/Reconnection

Alex Richardson alexrichardson at gmail.com
Wed Jun 11 16:27:07 BST 2008


I accidently responded to James' response without responding back to
the mailing list. I am forwarding the following question/response to
the mailing list in case it is useful to anyone else in the future. (I
also adding a short section to the manual)

-- My Question --
Thanks for the quick response. I was not aware of the reconnect that
would occur after calling rollback. I appreciate the clarification.

I do have another question related to transactions. My application is
multi-threaded; the Storm manual states that Store objects are not
thread safe, and a separate Store object should be created within each
thread. It state however that multiple threads can share a database
object. Does each Store object have its own transaction context then?
I.e. does each Store object make a separate connection to the
database? (I was under the impression that transactions were on a
per-connection basis in MySql)


--James' Response--

Each store has its own database connection.  The "database" object you
pass to the Store constructor is essentially a connection factory.  So
if you create one store per thread, you'll have one transaction active
per thread.



More information about the storm mailing list