From 6b8bbca2c59a66b1a6bb348af1430ced8d34e7ed Mon Sep 17 00:00:00 2001 From: cnapagoda Date: Mon, 17 Aug 2015 22:11:10 +0530 Subject: [PATCH] Remove registred task when restarting instance --- .../task/internal/RegistryTaskServiceComponent.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/registry/org.wso2.carbon.registry.task/src/main/java/org/wso2/carbon/registry/task/internal/RegistryTaskServiceComponent.java b/components/registry/org.wso2.carbon.registry.task/src/main/java/org/wso2/carbon/registry/task/internal/RegistryTaskServiceComponent.java index 9fb8de4ea..275464c39 100644 --- a/components/registry/org.wso2.carbon.registry.task/src/main/java/org/wso2/carbon/registry/task/internal/RegistryTaskServiceComponent.java +++ b/components/registry/org.wso2.carbon.registry.task/src/main/java/org/wso2/carbon/registry/task/internal/RegistryTaskServiceComponent.java @@ -100,6 +100,13 @@ protected void setTaskService(TaskService taskService) { } private void registerTasks(TaskManager taskManager) throws TaskException { + try { + for (TaskInfo taskInfo : taskManager.getAllTasks()) { + taskManager.deleteTask(taskInfo.getName()); + } + } catch (TaskException ignore){ + + } String configPath = CarbonUtils.getRegistryXMLPath(); if (configPath != null) { File registryXML = new File(configPath);