Hi,
> ________________________________
>
> De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] De la part de NeedBenzyn
NeedBenzyn
> Envoyé : 05 September 2008 5:42
> À : Jamu Kakar
> Cc : [email protected]
> Objet : Re: [storm] Consistent multithreaded operations
> Hi,
> thanks for you answer, i'm sorry I forgot to notice that my store object
is retrieved from an helper function which
> handle one store instance by thread :
> Database = create_database("mysql://"+
>
ServerConfig.dbUser+":"+ServerConfig.dbPassword+"@"+ServerConfig.dbHost+"/"+
ServerConfig.dbName)
> LocalStoreHolder = threading.local()
> def GetStore():
> global LocalStoreHolder
> global Database
> if (not hasattr(LocalStoreHolder,"store")):
LocalStoreHolder.store = Store(Database)
> log.msg("Returning store instance :%s for thread :
%s"%(LocalStoreHolder.store,threading.currentThread().getName()))
> return LocalStoreHolder.store
> _________________________________
In this case, although you have one store per thread, you still share one
connection to the database. Transactions are handled on a per-connection
basis, therefore you should create one connection for each thread and then
associate it to a new store, as Jamu suggested.
Raphaël
--
storm mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/storm