[pylucene-dev] PythonThread

Johan Jonkers johan at cq2.nl
Wed Feb 20 05:57:17 PST 2008


Thanks! :-)


Alexandre Fiori wrote:
> 
> johan, here's an example:
> 
> #!/usr/bin/env python
> import threading, lucene, time
> 
> class Test(threading.Thread):
>     def __init__(self):
>         threading.Thread.__init__(self)
>         self.vm = lucene.initVM(lucene.CLASSPATH, maxheap='512m')
> 
>     def run(self):
>         self.vm.attachCurrentThread()
>         r = lucene.IndexReader.open('index')
>         for n in range(5):
>             print 'n is %d' % n
>             time.sleep(0.5)
>         print r.numDocs()
>         r.close()
> 
> 
> z = Test()
> z.start()
> 
> 
> On Tue, Feb 19, 2008 at 9:31 PM, Andi Vajda <vajda at osafoundation.org 
> <mailto:vajda at osafoundation.org>> wrote:
> 
> 
>     On Tue, 19 Feb 2008, Johan Jonkers wrote:
> 
>      > In our code we use PyLucene's PythonThread class, but I dont see
>     it anymore
>      > in PyLucene 2.3? Has it been replaced? I cant seem to find any
>     documentation
>      > on it  either.
> 
>     PyLucene 2.3.0 is jcc-PyLucene which doesn't have the threading problems
>     that plagued gcj-PyLucene. PythonThread is gone, you can use regular
>     Python
>     threads instead. Just be sure to call attachCurrentThread() as is
>     described
>     in [1] and [2].
>     [3] is also recommented reading as are the INSTALL files in the same
>     directories.
> 
>     Andi..
> 
>     [1] http://svn.osafoundation.org/pylucene/trunk/README
>     [2] http://svn.osafoundation.org/pylucene/trunk/jcc/README
>     [3] http://svn.osafoundation.org/pylucene/trunk/jcc/jcc/README
>     _______________________________________________
>     pylucene-dev mailing list
>     pylucene-dev at osafoundation.org <mailto:pylucene-dev at osafoundation.org>
>     http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
> 
> 
> 
> 
> -- 
> Ship ahoy! Hast seen the While Whale?
> - Melville's Captain Ahab
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev



More information about the pylucene-dev mailing list