Resolving #695:Fix for Policy Delegation task is not starting for tenants in distributed setup

revert-70aa11f8
Harshan Liyanage 8 years ago committed by amalhub
parent 0eeef0a568
commit 273be79ca2

@ -144,6 +144,8 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
//Check whether the TaskType is already registered. If not we'll register it here. //Check whether the TaskType is already registered. If not we'll register it here.
if (!registeredTaskTypes.contains(PolicyManagementConstants.DELEGATION_TASK_TYPE)) { if (!registeredTaskTypes.contains(PolicyManagementConstants.DELEGATION_TASK_TYPE)) {
taskService.registerTaskType(PolicyManagementConstants.DELEGATION_TASK_TYPE); taskService.registerTaskType(PolicyManagementConstants.DELEGATION_TASK_TYPE);
}
TaskInfo registeredTaskInfo = null; TaskInfo registeredTaskInfo = null;
// getTask method will throw a TaskException if the task is not registered. Hence we'll handle the // getTask method will throw a TaskException if the task is not registered. Hence we'll handle the
// exception and register the task. // exception and register the task.
@ -158,8 +160,6 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
properties, triggerInfo); properties, triggerInfo);
taskManager.registerTask(taskInfo); taskManager.registerTask(taskInfo);
taskManager.scheduleTask(taskInfo.getName()); taskManager.scheduleTask(taskInfo.getName());
}
}
} else { } else {
if (!taskManager.isTaskScheduled(taskName)) { if (!taskManager.isTaskScheduled(taskName)) {
TaskInfo taskInfo = new TaskInfo(taskName, PolicyManagementConstants.DELEGATION_TASK_CLAZZ, TaskInfo taskInfo = new TaskInfo(taskName, PolicyManagementConstants.DELEGATION_TASK_CLAZZ,
@ -171,6 +171,8 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint {
"changes after few minutes."); "changes after few minutes.");
} }
} }
}
} catch (TaskException e) { } catch (TaskException e) {
String msg = "Error occurred while creating the policy delegation task for tenant " + String msg = "Error occurred while creating the policy delegation task for tenant " +
PrivilegedCarbonContext. PrivilegedCarbonContext.

Loading…
Cancel
Save