diff --git a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/AccountValidatorThread.java b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/AccountValidatorThread.java index 58fa62eba..572da6774 100644 --- a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/AccountValidatorThread.java +++ b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/AccountValidatorThread.java @@ -90,7 +90,7 @@ private void handleTask(String tenantDomain) { } // Run the task only from master node in cluster setup. - if (isClusterModeEnabled() && !isHazelcastMasterNode()) { + if (isMasterNodeExclusiveExecutionEnabled() && !isHazelcastMasterNode()) { return; } @@ -174,13 +174,13 @@ private void handleTask(String tenantDomain) { } /** - * Check whether suspension task runs in cluster or not. + * Check whether suspension task configured to run only in master node or not. * * @return true or false based on the deployment config. */ - private boolean isClusterModeEnabled() { + private boolean isMasterNodeExclusiveExecutionEnabled() { - String clusterModeEnabledValue = IdentityUtil.getProperty(NotificationConstants.EXECUTE_TASK_IN_SINGLE_NODE); + String clusterModeEnabledValue = IdentityUtil.getProperty(NotificationConstants.EXECUTE_TASK_IN_MASTER_NODE); return StringUtils.isNotBlank(clusterModeEnabledValue) ? Boolean.parseBoolean(clusterModeEnabledValue) : false; } diff --git a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/internal/NotificationTaskServiceComponent.java b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/internal/NotificationTaskServiceComponent.java index cb2f91ccd..d2f882d17 100644 --- a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/internal/NotificationTaskServiceComponent.java +++ b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/internal/NotificationTaskServiceComponent.java @@ -164,6 +164,7 @@ protected void unsetRealmService(RealmService realmService) { policy = ReferencePolicy.DYNAMIC, unbind = "unsetClusteringAgent") protected void setClusteringAgent(ConfigurationContextService configurationContextService) { + NotificationTaskDataHolder.getInstance().setClusteringAgent( configurationContextService.getServerConfigContext().getAxisConfiguration().getClusteringAgent()); } diff --git a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/util/NotificationConstants.java b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/util/NotificationConstants.java index 51f73f1d5..048ff4fd0 100644 --- a/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/util/NotificationConstants.java +++ b/components/org.wso2.carbon.identity.account.suspension.notification.task/src/main/java/org/wso2/carbon/identity/account/suspension/notification/task/util/NotificationConstants.java @@ -27,7 +27,7 @@ public class NotificationConstants { public static final String SUSPENSION_NOTIFICATION_TRIGGER_TIME= "suspension.notification.trigger.time"; public static final String SUSPENSION_NOTIFICATION_DELAYS="suspension.notification.delays"; public static final String USE_IDENTITY_CLAIM_FOR_LAST_LOGIN_TIME = "AccountSuspension.UseIdentityClaims"; - public static final String EXECUTE_TASK_IN_SINGLE_NODE = "AccountSuspension.ExecuteTaskOnSingleNode"; + public static final String EXECUTE_TASK_IN_MASTER_NODE = "AccountSuspension.ExecuteTaskOnMasterNode"; public static final String TRIGGER_TIME_FORMAT = "HH:mm:ss"; public static final long SCHEDULER_DELAY = 24; // In hours public static final String SUSPENSION_NOTIFICATION_THREAD_POOL_SIZE = "suspension.notification.thread.pool.size";