notify cluster formation changed nug fixes

issue-10462/secure-pending-operation-6.2
Amalka Subasinghe 1 year ago
parent 615da6303f
commit 66f33f4845

@ -61,10 +61,6 @@ public class HeartBeatBeaconComponent {
DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig(); DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig();
HeartBeatBeaconDAOFactory.init(dsConfig); HeartBeatBeaconDAOFactory.init(dsConfig);
//Setting up executors to notify heart beat status */
HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails());
}
ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository ClusterFormationChangedNotifierRepository clusterFormationChangedNotifierRepository
= new ClusterFormationChangedNotifierRepository(); = new ClusterFormationChangedNotifierRepository();
List<String> notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers(); List<String> notifiers = HeartBeatBeaconConfig.getInstance().getNotifiers();
@ -76,6 +72,12 @@ public class HeartBeatBeaconComponent {
HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository( HeartBeatBeaconDataHolder.getInstance().setClusterFormationChangedNotifierRepository(
clusterFormationChangedNotifierRepository); clusterFormationChangedNotifierRepository);
//Setting up executors to notify heart beat status */
HeartBeatExecutor.setUpNotifiers(HeartBeatBeaconUtils.getServerDetails());
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Heart Beat Notifier bundle has been successfully initialized"); log.debug("Heart Beat Notifier bundle has been successfully initialized");
} }

@ -261,7 +261,9 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic
public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException { public void notifyClusterFormationChanged(int elapsedTimeInSeconds) throws HeartBeatManagementException {
if (HeartBeatBeaconConfig.getInstance().isEnabled()) { if (HeartBeatBeaconConfig.getInstance().isEnabled()) {
try { try {
HeartBeatBeaconDAOFactory.beginTransaction();
Map<String, ServerContext> servers = heartBeatDAO.getActiveServerDetails(elapsedTimeInSeconds); Map<String, ServerContext> servers = heartBeatDAO.getActiveServerDetails(elapsedTimeInSeconds);
HeartBeatBeaconDAOFactory.commitTransaction();
if (servers != null && !servers.isEmpty()) { if (servers != null && !servers.isEmpty()) {
String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID(); String serverUUID = HeartBeatBeaconDataHolder.getInstance().getLocalServerUUID();
ServerContext serverContext = servers.get(serverUUID); ServerContext serverContext = servers.get(serverUUID);
@ -289,6 +291,13 @@ public class HeartBeatManagementServiceImpl implements HeartBeatManagementServic
String msg = "Error occurred while notifyClusterFormationChanged."; String msg = "Error occurred while notifyClusterFormationChanged.";
log.error(msg, e); log.error(msg, e);
throw new HeartBeatManagementException(msg, e); throw new HeartBeatManagementException(msg, e);
} catch (TransactionManagementException e) {
HeartBeatBeaconDAOFactory.rollbackTransaction();
String msg = "Error occurred while electing candidate for dynamic task execution. Issue in opening a connection to the underlying data source";
log.error(msg, e);
throw new HeartBeatManagementException(msg, e);
} finally {
HeartBeatBeaconDAOFactory.closeConnection();
} }
} else { } else {
String msg = "Heart Beat Configuration Disabled. Error while notifyClusterFormationChanged."; String msg = "Heart Beat Configuration Disabled. Error while notifyClusterFormationChanged.";

Loading…
Cancel
Save