Hi Ishara,

The "taskType" is, as it says, the type of the task we are scheduling. It
is to logically group a set of tasks, and is given to each task being
scheduled. So after the task type, you will need the actual task name,
which can be listed by the tasks from the TaskManager as I remember. So do
get the actual task names and pass it to the getTaskState method and see

Cheers,
Anjana.

On Tue, Nov 25, 2014 at 6:14 PM, Ishara Cooray <isha...@wso2.com> wrote:

>  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
>



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

Reply via email to