An application, completely scheduled and monitored by some Job Monitor, implements a JMSMessageListener... now what is the best way to prevent this main thread (which is registering itself on JMS Queue) not to finish it's execution. Otherwise Job monitor will mark this job as completed while on message event thead was supposed to work instead.
There are 2 ways-
1st way
import timer
some other tasks... JMS Queue registration for messages
timer.sleep(_LONG_TIME) # this will stop it from leaving execution
2nd way-
from twisted.internet import reactor
some other tasks... JMS Queue registration for messages'''
reactor.run() # this will send execution control to reactor
So now as I understood this... sleeping a thread will not impact CPU and machine resources. While I am not that sure what's happening, once control goes to reactor ?