i am using following code snippet to find the state of a particular task
running on BAM.

BundleContext ctx =

BundleReference.class.cast(TaskService.class.getClassLoader())
                        .getBundle()
                        .getBundleContext();

 ServiceReference serviceReference =
ctx.getServiceReference(TaskService.class.getName());

 TaskService taskService
=TaskService.class.cast(ctx.getService(serviceReference));
 Set<String> taskTypes=taskService.getRegisteredTaskTypes();

 for(String taskType : taskTypes){
         TaskManager taskManager = taskService.getTaskManager(taskType); //
what is the string argument to be passed here

            taskState= taskManager.getTaskState(taskType).name();

                log.info("Task Type: "+taskType+"  State : "+ taskState);
            }

But i get state as NONE for each task type.

Ex: output
[2014-11-25 17:40:56,969]  INFO - TaskSchedulingTest:  Task Type:
logSummarizer  State : NONE
[2014-11-25 17:40:59,999]  INFO - TaskSchedulingTest:  Task Type:
JMX_SERVICE_TASK  State : NONE
[2014-11-25 17:41:01,568]  INFO - TaskSchedulingTest:  Task Type:
BAM_NOTIFICATION_DISPATCHER_TASK  State : NONE
[2014-11-25 17:41:02,948]  INFO - TaskSchedulingTest:  Task Type:
HIVE_TASK  State : NONE

Wondering whether taskManager instance is correct as im passing tasktype to
get the taskmanager instance and again i use the taskType to get the state
from the getTaskState method.

Please clarify where i am getting wrong or what is the best way to get the
task state?

Thanks & Regards,

Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
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