This currently lives in a specific project but I have considered
pulling it out and making it more general:

http://bfg.repoze.org/pastebin/715

The main thing you would need to do to make it a general purpose
ResourcePool would be to pass a resource_factory callable into the
constructor and, optionally, a ping callable for checking that the
resource is still usable.  The cleanup thread is probably a little
fishy.  And this package doesn't provide any sort of threadlocals.
The application does get a connection per thread and store it in a
threadlocal, but that's outside the scope of the resource pool
implementation.

Chrsi


On Thu, Apr 29, 2010 at 10:44 AM, Chris Withers <ch...@simplistix.co.uk> wrote:
> Not strictly speaking a repoze question, but the people who live here
> have likely bumped into this, and I value your wise opinions :-)
>
> So, SQLAlchemy takes care of having one session per thread and a
> connection pool for you, however what about resources where that's not
> the case.
>
> For me, it's a stomp client for sending stomp messages, but I guess it
> could be an ftp connection, etc.
>
> Are there any tools around for managing one connection per thread and/or
> connection pooling in an abstract way that I could re-use?
>
> cheers,
>
> Chris
>
> _______________________________________________
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
>
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to