Hi Devs, I ran into some buggy looking code related to tasks. When a new task is created the SimpleQuartz#init method is called. There we get a task scheduler instance using the following piece of code.
TaskScheduler taskScheduler = TaskSchedulerFactory.getTaskScheduler( SynapseConstants.SYNAPSE_STARTUP_TASK_SCHEDULER); Then when a task is stopped/removed SimpleQuartz#destroy method is called. There we try to get the task scheduler using the following line of code. TaskScheduler taskScheduler = taskHelper.getTaskScheduler(); The task schedulers returned at the two occasions are in fact different (confirmed by debugging). Therefore when a task is removed from the system at runtime, things are not cleaned up properly and the task will continue to run in the background. Also the task scheduler instance set to the task helper is never initialized. That is another problem I encountered. I feel that these are actually bugs. Can somebody who's more familiar with the Synapse tasks module shed some light on the subject? If somebody can confirm I can start working on fixing them. Thanks -- Hiranya Jayathilaka Software Engineer; WSO2 Inc.; http://wso2.org E-mail: [email protected]; Mobile: +94 77 633 3491 Blog: http://techfeast-hiranya.blogspot.com
