Affects Version/s: 2.3
Fix Version/s: None
Component/s: Collection Processing
If a daemon thread was started within an AE and keeps running independent of the AE processing (e.g. bound to a static variable) it prevents exiting of the CPE.
add following class to a AE:
and call DaemonThread.startThread(); within the process() method.
After CPE signals collectionProcesscomplete() the application does not exit.
The reason: in org.apache.uima.collection.impl.cpm.engine.CPMEngine a threadGroupDestroyer thread is created (line 2522) which waits for threads to die. Since it does not check for daemon threads it counts them as normal threads to wait for and thus it waits forever (this can be seen with kill -3 PID to get a JAVA stack trace of all threads under UNIX).
A workaround would be to put the daemon thread in another ThreadGroup. In the example if you create the tread with
(in the top most thread group) the CPE exits normally.
However this is not possible with closed source libraries.
Thus the threadGroupDestroyer must test for daemon threads. Furthermore the used group.activeCount() (in org.apache.uima.collection.impl.cpm.engine.CPMEngine) should only be used for information purposes - as the javadoc states - not for relying on it as a loop parameter.