}
try {
boolean healthyRegistrant = RegistrantUtil.isHealthy(registrant);
if (!healthyRegistrant && registrant.running()) {
registrant.stop();
new Thread(new InstanceStateNotificationClientThread(registrant, "INACTIVE")).start();
log.warn("Stopped registrant " + registrant + " since it is unhealthy." );
} else if (healthyRegistrant && !registrant.running()) {
registrant.stop();
new Thread(new InstanceStateNotificationClientThread(registrant, "INACTIVE")).start();
clusteringClient.joinGroup(registrant, configurationContext);
log.info("Restarted registrant " + registrant + " after it became active");
}
} catch (Exception e) {
log.error("Error occurred while running registrant health check", e);