[pylucene-dev] detachCurrentThread crash

anurag uniyal anuraguniyal at yahoo.com
Mon Jan 14 20:51:06 PST 2008


Skipped content of type multipart/alternative-------------- next part --------------
import threading

import lucene
lucene.initVM(lucene.CLASSPATH)

class MyThread(threading.Thread):
    def __init__(self):
        """
        pass the method to call, docs to process and whether it is a commit
        """
        threading.Thread.__init__(self)
        
    def run(self):
        lucene.getVMEnv().attachCurrentThread()
        try:
            self.func()
        except Exception,e:
            print e
        lucene.getVMEnv().detachCurrentThread()

    def func(self):
        doc = lucene.Document()
        raise Exception("Lets Crash!")

def main():
    t = MyThread()
    t.start()
    t.join()

main()


More information about the pylucene-dev mailing list