volatile lifetimes are only as long in as the object is in a non-ghost state. 
you can't reliably predict a period for this, but you can use a __setstate__ 
hook, to capture volatiles before the object is ghostified.

also its good practice to set a class attribute of the volatile to none, or 
use a computed attribute to set the initial value of a volatile, imo.

-kapil

On Thursday 24 October 2002 01:05 am, Joost van Lawick wrote:
> Hello,
>
> I am working on a Zope product that throws data into a queue that is
> monitored by a number (3) of producers. Producers can talk to Corba
> objects. I use omniOrb for this. Producers take out data from the outqueue
> and send it to other Corba objects. This is the basic setup:
>
> class SIPConnector(SimpleItem):
>      """Connector class"""
>
>    def __init__(self, id, title):
>       self.id = id
>       self.title = title
>       self.n = 3    # number of producers
>
>    def initConnectionPool(self):
>       self._v_outqueue = Queue.Queue()
>
>       for i in range(self.n):
>          id = 'tc' + str(i)
>          tp = SIPProducer(id)
>          thread.start_new_thread(self.runProducer, (tc, self._v_outqueue,))
>
>    def post(self, sid, to, msg):
>       self._v_outqueue.put(sid, to, msg)
>
>
>    def runProducer(self, tp, oq):
>       # connect to Corba dispatcher
>       tp.orb, tp.cmf = tp._connect()
>
>       while 1:
>          try:
>             msg = oq.get(0)
>             print msg
>             tp..cmf.xmit(msg)
>          except Queue.Empty:
>             time.sleep(0.05)
>
>
>
>
> class SIPProducer(CorbaBaseClass):
>
>    def __init__(self, id):
>       self.id = id
>
>
> This basically works. However, if I put msg's in the queue with the post
> method from a page template, and I do this a couple of times, quickly, I
> get an attribute error on self._v_inqueue. It is somehow gets lost. Does
> anyone know what I am doing wrong here? What happened to the 'lost' queue?
>
>
> Cheers,
>
>
> Joost


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to