private void deletePurgingTasks(String scriptFilePath) {
   File deploymentFileData = new File(scriptFilePath);
   int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
   log.info(
       "Undeploying purging task : " + deploymentFileData.getName() + " for tenant : " + tenantId);
   try {
     AnalyticsDataPurgingConfiguration purgingConfiguration =
         getAnalyticsDataPurgingConfiguration(deploymentFileData);
     if (purgingConfiguration != null) {
       if (purgingConfiguration.getPurgingIncludeTables() != null) {
         TaskManager taskManager =
             AnalyticsServiceHolder.getTaskService()
                 .getTaskManager(Constants.ANALYTICS_DATA_PURGING);
         for (AnalyticsDataPurgingIncludeTable analyticsDataPurgingIncludeTable :
             purgingConfiguration.getPurgingIncludeTables()) {
           if (analyticsDataPurgingIncludeTable.getValue() != null
               && !analyticsDataPurgingIncludeTable.getValue().isEmpty()) {
             taskManager.deleteTask(
                 getDataPurgingTaskName(analyticsDataPurgingIncludeTable.getValue()));
           }
         }
       }
     }
   } catch (TaskException e) {
     log.error(
         "Unable to get task manager instance for ANALYTICS_DATA_PURGING:" + e.getMessage(), e);
   }
 }
 public void removeProfile(String profileName) throws AxisFault {
   try {
     TaskManager tm =
         JmxTaskServiceComponent.getTaskService()
             .getTaskManager(JmxConstant.JMX_SERVICE_TASK_TYPE);
     tm.deleteTask(profileName);
     log.info(profileName + " disabled.");
   } catch (TaskException e) {
     log.error(e);
   }
 }
 public boolean delete(String taskName) {
   if (!isInitialized()) {
     return false;
   }
   if (taskName == null) {
     return false;
   }
   String list[] = taskName.split("::");
   String name = list[0];
   if (name == null || "".equals(name)) {
     throw new SynapseTaskException("Task name is null. ", logger);
   }
   String group = list[1];
   if (group == null || "".equals(group)) {
     group = TaskDescription.DEFAULT_GROUP;
     if (logger.isDebugEnabled()) {
       logger.debug(
           "Task group is null or empty , using default group :" + TaskDescription.DEFAULT_GROUP);
     }
   }
   try {
     boolean deleted;
     synchronized (lock) {
       deleted = taskManager.deleteTask(name);
     }
     if (deleted) {
       NTaskAdapter.removeProperty(taskName);
     }
     logger.debug("Deleted task [" + name + "] [" + deleted + "]");
     return deleted;
   } catch (Exception e) {
     logger.error(
         "Cannot delete task [" + taskName + "::" + group + "]. Error: " + e.getLocalizedMessage(),
         e);
     return false;
   }
 }