Hi Shafreen,

Yeah, that's a bug! .. good catch. The issue is, as you said, we just
having a singe TriggerListener for all the tenants/task-types, where we
should actually be having a single TriggerListener for one TaskManager (per
tenant/task-type). So the correct fix is registering a matcher in the
current code, in the constructor to give the matcher. I've fixed this in
GitHub now, with this commit [1]. Please check and verify.

[1]
https://github.com/wso2/carbon-commons/commit/5df4e830bb7d93d0a85085a5ff21e98d65b88283

Cheers,
Anjana.

On Sat, Feb 28, 2015 at 4:21 PM, Shafreen Anfar <[email protected]> wrote:

> Hi Anjana,
>
> This [1] happens when we schedule tasks with different tenants. When I dug
> deep I saw that tasks try to update its state to FINISH state using
> TriggerListeners. I believe this is where the problem is. It seems the last
> registered listener is getting notified for all the tasks. I think it is
> because we are not using a matcher, the registered listener receives events
> for all the triggers [2].
>
> Therefore, I changed the code as in the attached diff and I could not
> observe the issue any more. When I debugged I could see that all the task's
> states are getting updated properly. Can you please help us on this matter ?
>
> [1]
>
> org.wso2.carbon.ntask.common.TaskException: The task 'super_tenent' does
> not exist
> at
> org.wso2.carbon.ntask.core.impl.RegistryBasedTaskRepository.getTaskMetadataPropResource(RegistryBasedTaskRepository.java:310)
> at
> org.wso2.carbon.ntask.core.impl.RegistryBasedTaskRepository.setTaskMetadataProp(RegistryBasedTaskRepository.java:323)
> at org.wso2.carbon.ntask.core.TaskUtils.setTaskState(TaskUtils.java:109)
> at org.wso2.carbon.ntask.core.TaskUtils.setTaskFinished(TaskUtils.java:146)
> at
> org.wso2.carbon.ntask.core.impl.AbstractQuartzTaskManager$TaskTriggerListener.triggerComplete(AbstractQuartzTaskManager.java:424)
> at
> org.quartz.core.QuartzScheduler.notifyTriggerListenersComplete(QuartzScheduler.java:1876)
> at
> org.quartz.core.JobRunShell.notifyTriggerListenersComplete(JobRunShell.java:377)
> at org.quartz.core.JobRunShell.run(JobRunShell.java:254)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by:
> *org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException*:
> Resource does not exist at path
> /_system/governance/repository/components/org.wso2.carbon.tasks/definitions/1/ESB_TASK/super_tenent
> at
> org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.get(EmbeddedRegistry.java:532)
> at
> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getGhostResourceFromCache(CacheBackedRegistry.java:194)
> at
> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.get(CacheBackedRegistry.java:167)
> at
> org.wso2.carbon.registry.core.session.UserRegistry.getInternal(UserRegistry.java:613)
> at
> org.wso2.carbon.registry.core.session.UserRegistry.access$400(UserRegistry.java:60)
> at
> org.wso2.carbon.registry.core.session.UserRegistry$5.run(UserRegistry.java:596)
> at
> org.wso2.carbon.registry.core.session.UserRegistry$5.run(UserRegistry.java:593)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.wso2.carbon.registry.core.session.UserRegistry.get(UserRegistry.java:593)
> at
> org.wso2.carbon.ntask.core.impl.RegistryBasedTaskRepository.getTaskMetadataPropResource(RegistryBasedTaskRepository.java:306)
> ... 12 more
>
> [2]
> http://quartz-scheduler.org/api/2.2.0/org/quartz/ListenerManager.html#addTriggerListener(org.quartz.TriggerListener)
>
> --
> Regards,
> *Shafreen*
> Software Engineer
> WSO2 Inc
> Mobile : 077-556-395-1
>



-- 
*Anjana Fernando*
Senior 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