On Friday January 11 2008 11:31:31 am Andi Vajda wrote:
> On Fri, 11 Jan 2008, Pete wrote:
> > On Thursday January 10 2008 5:56:53 pm Andi Vajda wrote:
> >> On Thu, 10 Jan 2008, Andi Vajda wrote:
> >>>      I think I'm going to be adding support for the manual way via
> >>>      finalize() shortly.
> >>
> >> This just got checked in to rev 377.
> >
> > Can finalize be called for 'regular' Java instances, or only Python
> > extensions?  If the later, it's gonna make writing generic code that uses
> > such instances harder.  Actually, I'm not sure how to do such a thing...
>
> finalize() is to be called only on extensions. Normally, the Java
> finalize() method is protected, not public, and does nothing. Therefore not
> wrapper is generated for it by jcc. For extensions, though, finalize()
> helps in breaking the "deadly embrace" ref cycle between both VMs, Python
> and Java.

Ok, so if I have some code that manages the lifespan of a Lucene builtin OR 
Python extension (we're all duck-typers here), how is it supposed to know 
whether to call finalize or not?

Though, hmm, if I'm reading correctly, I could just do:

try:
    lucene_or_python_obj.finalize()
except AttributeError:
     pass  # must have been a pure lucene object

I guess that's ok.  Though it'd be really nice if you found a solution to 
automagically manage things without the explicit finalize()...   weakrefs 
maybe?

-- 
Peter Fein   ||   773-575-0694   ||   [EMAIL PROTECTED]
http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
irc: [EMAIL PROTECTED]   ||   jabber: [EMAIL PROTECTED]
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to