On Thu, 2008-07-03 at 15:59 +0200, Felix Schwarz wrote:
> Darren Govoni schrieb:
> > Ok, thanks. Let me try that. I read the README, but am new to PyLucene
> > and don't understand all of the docs just yet. But I'm learning!
> 
> In my TG app I fixed quite some crashing problems by doing this before every
> lucene operation:
> def init_lucene():
>       vm_env = lucene.getVMEnv()
>       if vm_env == None:
>           vm_env = lucene.initVM(lucene.CLASSPATH)
>       assert vm_env != None
>       vm_env.attachCurrentThread()
> 
> Of course a more elegant solution would be to call this only for every new 
> thread
> but I could find a way doing that in TG easily.

It works. In my CherryPy (a great built-in HTTP SDK by the way) class, I
simply add the attachCurrentThread() at the start of each web method:

vm=initVM(CLASSPATH)

....
    def extract(self, url = "http://www.aurl.com";):
        vm.attachCurrentThread()
        return process(url)

Since CherryPy invokes the method in its own parallel thread model, this
ensures each web method is properly attached.

Thanks again!

Darren


> 
> fs
> 
> PS: Please don't top post and don't use fullquote - please :-)

Ok, sorry about that! I sometimes top-post to reduce scrolling if I
don't have specific responses. :)

> 
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev@osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

_______________________________________________
pylucene-dev mailing list
pylucene-dev@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to