Issue #862 wontfix

ThreadMonitor needs explicit creation of 'start_thread' and 'stop_thread' listeners.

Anonymous created an issue

Reported by Andrew Stromnov stromnov@gmail.com

Comments (3)

  1. Anonymous

    For example, new version of pylucene (jcc based) needs explicit call of jvm.attachCurrentThread() (one per thread) before any calls to search engine.

    class LuceneThreadManager(SimplePlugin):
        
        def __init__(self, bus):
            super(LuceneThreadManager, self).__init__(bus)
            self.jvm = lucene.initVM(lucene.CLASSPATH, vmargs="-Xrs")
    
        def start_thread(self, i):
            self.jvm.attachCurrentThread()
    
        ...
    
    ThreadManager(bus).subscribe()
    LuceneThreadManager(bus).subscribe()
    

    But start_thread() method will not be executed, because of absence of 'start_thread' in listeners sets. There are two ways:

    1) explicit use of bus.subscribe(channel, callback, priority) method;

    2) explicitly define {{{

    1. ThreadManager() or LuceneThreadManager() def init(self, bus): ... self.bus.listeners.setdefault('start_thread', set()) self.bus.listeners.setdefault('stop_thread', set()) }}} and use automatic listeners binding in SimplePlugin.subscribe() method.
  2. Log in to comment