[Xapian-discuss] Xapian JNI questions

Olly Betts olly at survex.com
Fri Dec 8 04:29:41 GMT 2006


On Thu, Dec 07, 2006 at 09:35:11AM +0000, James Aylett wrote:
> The common practice is to have a close() method which closes the
> database, and have the destructor call that (then make close() safe
> for multiple calls).

There's a plan to add such a method to the C++ class, but it's not
as trivial as you might expect to do.  You can get similar issues with
the other bindings (Tcl doesn't call the destructor in some
circumstances, and accidentally indirectly hanging on to a reference
to a WritableDatabase in Python can cause similar headaches).

Looking at the JNI code, the WritableDatabase.finalize() serves as
such a method.  So just calling that is enough to flush the database,
close it, and release the lock.

Cheers,
    Olly



More information about the Xapian-discuss mailing list