[ZODB-Dev] Objects shared across transactions (requests)

Sergey Konozenko konozenko@certus.com
Wed, 19 Sep 2001 13:04:04 -0400


Hi Guys:

I have a design question I couldn't find the answer to.

I have several places in the current development which popup the question.
It's about sharing an object across different transactions (HTTP requests).

One example would be an XML-RPC-based logging service for a distributed
application.

As far as I understand, each HTTP request is served via a separate
transaction in Zope.
Each transaction has it's own connection to ZODB. Each connection keeps it's
own copies of objects. Or, just copies of objects already modified by the
transaction?

My questions:
1) What I need is a way to share the same object between transaction threads
so that it's method(s) can use locks to write to external resources or do
some other processing in an atomic way (without being interrupted by similar
requests from other threads).

2) If I think of using a Queue.Queue as a member of such object, I need a
way to start my own separate thread when Zope starts and quit this thread
when Zope is shut down. This thread will be polling the queue object,
receiving queue elements when they are created by request threads. So, the
question is, how can my code be notified when Zope is started and when it's
shutting down.

I'm not sure if these questions are not off-topic of this list. I apologize
if they are not and appreciate any information pointing to appropriate
discussions or How-tos, etc.

Thanks for your time gentlemen,

Sergey Konozenko

Certus International, Inc.
864 Mapleton Rd.
Princeton, NJ 08540
(P)609.919.3700 x223
(F)609.919.3707
skonozenko@certus.com