[Zope-dev] ZODB, Threads and Persistence

Magnus Heino magnus.heino@rivermen.se
Fri, 10 Nov 2000 23:03:33 +0100


> 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.

I guess I wasn't clear enough, but my application isnt within zope, im
just using zodb and some more components out of it.


> 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.

But I guess this still will be the same anyway. That is, if an object
inhereted from Persistence.Persistance spawns a thread that
manipulated data in the object, I will have no problems. The thread
will be running just fine, and the data will be stored in the zodb.

?

/Magnus
> 
> ----- Original Message -----
> From: "Magnus Heino (Rivermen)" <magnus.heino@rivermen.se>
> To: <zope-dev@zope.org>
> 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
> using
> > 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
> a
> > reference to a thread that is running??
> >
> > Or can I start my thread when the object first is used, and rely
on that
> it
> > will be running until I stop it or remove any reference to it?
> >
> >
> > /Magnus
> >
> >
> > _______________________________________________
> > Zope-Dev maillist  -  Zope-Dev@zope.org
> > http://lists.zope.org/mailman/listinfo/zope-dev
> > **  No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope )
> >
> >
> 

--

/Magnus Heino