From: Max I. <ma...@uc...> - 2003-12-01 11:36:19
|
>>>Lately I have been thinking that I should just create a new db >>>connection in the __init__ and check it in awake, since pretty much >>>every servlet uses the database. >> >>But this is dangerous because then db coon can be shared across >>threads (servlets are shared, right?). > > > Nope. Servlet instances are taken from a pool and a servlet instance can > only be in use by a single thread at a time. Additional servlet instances > are created as needed. Wow. That's very good news. So, I can be sure that any servlet's instance variable won't be accessed by multiple threads, right? In contrary to session's data, which can be accessed by several threads sometimes (as Ian told). |