Hi Nirmal,

On Wed, Oct 24, 2012 at 8:58 AM, Nirmal Fernando <[email protected]> wrote:

> Hi All,
>
> I observed the $subject. It makes confusions like below.
>
> Initially as a first time user, I called registerTask first and then
> scheduleTask operation.
>
> Then there's this exception saying that the task is already started.
>

"registerTask" does not schedule the task, it only registers the task. You
will have to call "scheduleTask" to schedule the task. And after it is
scheduled, it will remember the task was scheduled, and when the server is
restarting, the server will automatically schedule all the tasks. So the
scheduleTask method is suppose to be used when you want to immediately
schedule the task when you register it, for example, like from an UI. Then
afterwards, these will be automatically scheduled the next time the server
starts. So if you got an exception saying, the task already started, that
mean, you may have called "sheduleTask" on an already started task.


>
> What's the purpose of this internal scheduleAllTasks call? Isn't it a
> responsibility of the API user to call "scheduleTask" operation?
>

This is used to start all the registered tasks, and is called when the
server is starting, it is not the user's responsibility to schedule the
task always after it scheduled once. These tasks are persisted and will be
automatically started.

Also a thing to note is, you should only call the "registerTaskType" for a
specific task type only once when the server is starting, most probably
from a service component's init() method. Or else, if you call it multiple
times, it will result in all the services under that task type being
scheduled again, and you will get errors saying you're task is already
started.

Cheers,
Anjana.


>
> --
>
> Thanks & regards,
> Nirmal
>
> Software Engineer- Platform Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>



-- 
*Anjana Fernando*
Associate Technical Lead
WSO2 Inc. | http://wso2.com
lean . enterprise . middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to