Christoph Zwerschke said:
> * My last important question: Maybe I understand something wrong,
> but if I use DBPool for WebKit servlets, i.e. with the
> ThreadedAppServer, wouldn't it be much more reasonable to
> automatically bind the connections 1:1 to the servlet threads
> created by the AppServer, instead of making an independent
> database connection pool? So each thread would have it's own
> private database connection, servlets could never block each
> other, there would be no threadsafety issues at all,
> and you wouldn't need to configure any pool size,
> but there would be always just as many connections as stated
> in the AppServer.config. As far as I see it, this would have
> only advantages. Do I overlook anything?
> Could this be implemented with Webware/WebKit out of the box?
> If not, shouldn't such a feature be added?
>
This should be easy to do. You can get the current Thread object like this:
import threading
t = threading.currentThread()
Then you can get and set arbitrary attributes on that thread to achieve
thread-local storage. So a simple implementation of a function that gets a
thread-local connection could look like this:
import threading
def getConnection():
t = threading.currentThread()
try:
return t.thread_local_connection
except AttributeError:
connection = CreateConnection()
t.thread_local_connection = connection
return connection
- Geoff
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Webware-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/webware-devel