Thanks Hiranya for point out this error… Those are my faults
TaskSchedulerFactory is the initially written code to get / create a
TaskScheduler
SynapseConstants.SYNAPSE_STARTUP_TASK_SCHEDULER is also old constant
prior to move code into a new task module. After that it should uses
TaskConstants.TASK_SCHEDULER.
Unforunaly …seems, I have forgotten to remove it...
TaskScheduler taskScheduler = TaskSchedulerFactory.getTaskScheduler(
SynapseConstants.SYNAPSE_STARTUP_TASK_SCHEDULER);
This is also the old code prior to add TaskHelper... seems I have
forgotten to remove this too...
Really TaskHelper should rename to Task Component Manager or something
And within method TaskHelper.init … I didn’t initialize actual
TaskScheduler to make it late until first task is run.
Fix …
Anything, begin with SynapseConstants.* should be removed only uses
constant in Task module
Rename TaskHelper to Task Component Manager to something
Then uses that class to init task component and get resources inside
task component. (i.e. task scheduler and task description repository)
… simply consider TaskSchedulerFactory as a internal class and
TaskHelper as the public class
Hiranya … I haven’t any time these day to fix and test ..and it is
great if you can do this …and in a proper way.
Thanks
Indika
On Fri, Sep 11, 2009 at 5:08 PM, Hiranya Jayathilaka
<[email protected]> wrote:
> FYI this is how we initialize the TaskHelper.
>
> taskHelper.init(
>
> TaskDescriptionRepositoryFactory.getTaskDescriptionRepository(
> TaskConstants.TASK_DESCRIPTION_REPOSITORY),
>
> TaskSchedulerFactory.getTaskScheduler(TaskConstants.TASK_SCHEDULER));
>
> Note that we use one task scheduler to initialize the helper and use a
> different one when initializing SimpleQuartz instances.
>
> Thanks,
> Hiranya
>
> On Fri, Sep 11, 2009 at 4:29 PM, Hiranya Jayathilaka <[email protected]>
> wrote:
>>
>> 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
>
>
>
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.; http://wso2.org
> E-mail: [email protected]; Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]