AFAIK, you should be able to spawn a new thread from within any function
within Zope and manipulate stuff in the ZODB as long as you lock properly.
The number of database connections is fixed, but arbitrary threads can take
up a database connection on  an ad-hoc basis.  If I were you, I'd mess
around a little bit by spawning threads within a Product, and causing the
thread to manipulate ZODB objects, keeping locking in mind.  I've done this
on a limited basis and it seems to work.

Specifically, an object may be "ghosted" if it hasn't been accessed in a
while.  That doesn't mean its state goes away, it just means that it needs
to reload its state when it's accessed again.  Your manipulation of the
object in a separate thread should prevent the object from being ghosted.

----- Original Message -----
From: "Magnus Heino (Rivermen)" <[EMAIL PROTECTED]>
Sent: Friday, November 10, 2000 10:35 AM
Subject: [Zope-dev] ZODB, Threads and Persistence

> Hi.
> Reading from Jims 'Introduction to the Zope Database':
> "An object's state may be freed at any time by the ZODB to conserve memory
> usage."
> What does this mean? That the object can be freed even though there are
> references to it?
> The reason I'm asking is becase I want to use threads and persistence
> together.
> I would like to inherit both threading.Thread and Persistence.Persistent,
> but that gives an error. I guess thats because of the ExtentionClass.
> However, if i only inherit Persistence.Persistent and starts a thread
> the thread module withing the persistent class, what will happen with it?
> Can the ZODB still decide to free my persistent object even thoght it has
> reference to a thread that is running??
> Or can I start my thread when the object first is used, and rely on that
> will be running until I stop it or remove any reference to it?
> /Magnus
> _______________________________________________
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> **  No cross posts or HTML encoding!  **
> (Related lists -
> )

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to