On Sat, Sep 6, 2008 at 1:26 AM, Raphael Saint-Pierre
<[EMAIL PROTECTED]> wrote:
>> 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.
That is not correct. The database object returned by
create_database() is a connection factory.rather than a connection
itself. So each of the stores has its own connection.
James.
--
storm mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/storm