One technique I've thought about in lieu of round-robin pooling is
simply allocating one connection per thread.  E.g.:

def makeConnection():
    return dbadapter.connect(arg1, arg2, etc)

_connectionPool = {}
def getConnection():
    name = threading.currentThread().getName()
    if not _connectionPool.has_key(name):
        _connectionPool[name] = makeConnection()
    return _connectionPool[name]


Of course, you could phrase this as a wrapper just like DBPool.  I can't
decide if there's any advantages to this or not.  It doesn't rely on
garbage collection, but a single thread can't get more than one
connection (though I don't know if that's generally needed), and passing
connections between threads might be problematic.

  Ian



_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to