Program: 116225
Project: 116225
Buggy source:
private void addEventListeners(){
  topologyEventReceiver.addEventListener(new CompleteTopologyEventListener(){
    @Override protected void onEvent(    Event event){
      if (!topologyInitialized) {
        log.info("String_Node_Str" + event.getClass());
        ApplicationHolder.acquireReadLock();
        try {
          Applications applications=ApplicationHolder.getApplications();
          if (applications != null) {
            for (            Application application : applications.getApplications().values()) {
              if (allClustersInitialized(application)) {
                startApplicationMonitor(application.getUniqueIdentifier());
              }
 else {
                log.error("String_Node_Str" + "String_Node_Str");
              }
            }
            topologyInitialized=true;
          }
 else {
            log.info("String_Node_Str");
          }
        }
 catch (        Exception e) {
          log.error("String_Node_Str",e);
        }
 finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ApplicationClustersCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        log.info("String_Node_Str" + event.getClass());
        ApplicationClustersCreatedEvent applicationClustersCreatedEvent=(ApplicationClustersCreatedEvent)event;
        String appId=applicationClustersCreatedEvent.getAppId();
        try {
          ApplicationHolder.acquireReadLock();
          startApplicationMonitor(appId);
        }
 catch (        Exception e) {
          String msg="String_Node_Str" + e.getLocalizedMessage();
          log.error(msg,e);
        }
 finally {
          ApplicationHolder.releaseReadLock();
        }
      }
 catch (      ClassCastException e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterActivatedEvent clusterActivatedEvent=(ClusterActivatedEvent)event;
      String clusterId=clusterActivatedEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterResetEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterResetEvent clusterResetEvent=(ClusterResetEvent)event;
      String clusterId=clusterResetEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
      monitor.destroy();
      monitor.setStatus(ClusterStatus.Created);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterInActivateEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterInactivateEvent clusterInactivateEvent=(ClusterInactivateEvent)event;
      String clusterId=clusterInactivateEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
      monitor.setStatus(ClusterStatus.Inactive);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterTerminatingEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterTerminatingEvent clusterTerminatingEvent=(ClusterTerminatingEvent)event;
      String clusterId=clusterTerminatingEvent.getClusterId();
      String instanceId=clusterTerminatingEvent.getInstanceId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        ClusterStatusEventPublisher.sendClusterTerminatedEvent(clusterTerminatingEvent.getAppId(),clusterTerminatingEvent.getServiceName(),clusterId,instanceId);
        return;
      }
      if (monitor.getStatus() == ClusterStatus.Active) {
        monitor.setStatus(ClusterStatus.Terminating);
        InstanceNotificationPublisher.sendInstanceCleanupEventForCluster(clusterId);
      }
 else {
        monitor.setStatus(ClusterStatus.Terminating);
        monitor.terminateAllMembers();
      }
      ServiceReferenceHolder.getInstance().getClusterStatusProcessorChain().process("String_Node_Str",clusterId,instanceId);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterTerminatedEvent clusterTerminatedEvent=(ClusterTerminatedEvent)event;
      String clusterId=clusterTerminatedEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        ApplicationMonitor appMonitor=AutoscalerContext.getInstance().getAppMonitor(clusterTerminatedEvent.getAppId());
        if (appMonitor != null) {
          appMonitor.onChildStatusEvent(new ClusterStatusEvent(ClusterStatus.Terminated,clusterId,null));
        }
        return;
      }
      monitor.setStatus(ClusterStatus.Terminated);
      monitor.destroy();
      AutoscalerContext.getInstance().removeClusterMonitor(clusterId);
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberReadyToShutdownEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberReadyToShutdownEvent memberReadyToShutdownEvent=(MemberReadyToShutdownEvent)event;
        String clusterId=memberReadyToShutdownEvent.getClusterId();
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        AbstractClusterMonitor monitor;
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberReadyToShutdownEvent(memberReadyToShutdownEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberStartedEventListener(){
    @Override protected void onEvent(    Event event){
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberTerminatedEvent memberTerminatedEvent=(MemberTerminatedEvent)event;
        String clusterId=memberTerminatedEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberTerminatedEvent(memberTerminatedEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberActivatedEvent memberActivatedEvent=(MemberActivatedEvent)event;
        String clusterId=memberActivatedEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberActivatedEvent(memberActivatedEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberMaintenanceListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberMaintenanceModeEvent maintenanceModeEvent=(MemberMaintenanceModeEvent)event;
        String clusterId=maintenanceModeEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberMaintenanceModeEvent(maintenanceModeEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterInstanceCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      ClusterInstanceCreatedEvent clusterInstanceCreatedEvent=(ClusterInstanceCreatedEvent)event;
      AbstractClusterMonitor clusterMonitor=AutoscalerContext.getInstance().getClusterMonitor(clusterInstanceCreatedEvent.getClusterId());
      String instanceId=((ClusterInstanceCreatedEvent)event).getInstanceId();
      if (clusterMonitor != null) {
        TopologyManager.acquireReadLockForCluster(clusterInstanceCreatedEvent.getServiceName(),clusterInstanceCreatedEvent.getClusterId());
        try {
          Service service=TopologyManager.getTopology().getService(clusterInstanceCreatedEvent.getServiceName());
          if (service != null) {
            Cluster cluster=service.getCluster(clusterInstanceCreatedEvent.getClusterId());
            if (cluster != null) {
              try {
                if (cluster.isKubernetesCluster()) {
                  clusterMonitor.setClusterContext(ClusterContextFactory.getKubernetesClusterContext(instanceId,cluster));
                }
 else {
                  VMClusterContext clusterContext=(VMClusterContext)clusterMonitor.getClusterContext();
                  if (clusterContext == null) {
                    clusterMonitor.setClusterContext(ClusterContextFactory.getVMServiceClusterContext(instanceId,cluster));
                  }
 else {
                    clusterContext.addInstanceContext(instanceId,cluster);
                  }
                }
                if (clusterMonitor.hasMonitoringStarted().compareAndSet(false,true)) {
                  clusterMonitor.startScheduler();
                  log.info("String_Node_Str" + clusterInstanceCreatedEvent.getClusterId() + "String_Node_Str");
                }
              }
 catch (              PolicyValidationException e) {
                log.error(e.getMessage(),e);
              }
catch (              PartitionValidationException e) {
                log.error(e.getMessage(),e);
              }
            }
          }
 else {
            log.error("String_Node_Str" + clusterInstanceCreatedEvent.getServiceName() + "String_Node_Str"+ clusterInstanceCreatedEvent.getClusterId());
          }
        }
  finally {
          TopologyManager.releaseReadLockForCluster(clusterInstanceCreatedEvent.getServiceName(),clusterInstanceCreatedEvent.getClusterId());
        }
      }
 else {
        log.error("String_Node_Str" + clusterInstanceCreatedEvent.getClusterId());
      }
    }
  }
);
}

Fixed version (ground truth):
private void addEventListeners(){
  topologyEventReceiver.addEventListener(new CompleteTopologyEventListener(){
    @Override protected void onEvent(    Event event){
      if (!topologyInitialized) {
        log.info("String_Node_Str" + event.getClass());
        ApplicationHolder.acquireReadLock();
        try {
          Applications applications=ApplicationHolder.getApplications();
          if (applications != null) {
            for (            Application application : applications.getApplications().values()) {
              if (allClustersInitialized(application)) {
                DeploymentPolicy policy=PolicyManager.getInstance().getDeploymentPolicyByApplication(application.getUniqueIdentifier());
                if (policy != null) {
                  AutoscalerUtil.getInstance().startApplicationMonitor(application.getUniqueIdentifier());
                }
 else {
                  log.info("String_Node_Str" + "String_Node_Str" + application.getUniqueIdentifier());
                }
              }
 else {
                log.error("String_Node_Str" + "String_Node_Str");
              }
            }
            topologyInitialized=true;
          }
 else {
            log.info("String_Node_Str");
          }
        }
 catch (        Exception e) {
          log.error("String_Node_Str",e);
        }
 finally {
          ApplicationHolder.releaseReadLock();
        }
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ApplicationClustersCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        log.info("String_Node_Str" + event.getClass());
        ApplicationClustersCreatedEvent applicationClustersCreatedEvent=(ApplicationClustersCreatedEvent)event;
        String appId=applicationClustersCreatedEvent.getAppId();
        try {
          ApplicationHolder.acquireReadLock();
        }
 catch (        Exception e) {
          String msg="String_Node_Str" + e.getLocalizedMessage();
          log.error(msg,e);
        }
 finally {
          ApplicationHolder.releaseReadLock();
        }
      }
 catch (      ClassCastException e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterActivatedEvent clusterActivatedEvent=(ClusterActivatedEvent)event;
      String clusterId=clusterActivatedEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterResetEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterResetEvent clusterResetEvent=(ClusterResetEvent)event;
      String clusterId=clusterResetEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
      monitor.destroy();
      monitor.setStatus(ClusterStatus.Created);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterInActivateEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterInactivateEvent clusterInactivateEvent=(ClusterInactivateEvent)event;
      String clusterId=clusterInactivateEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        return;
      }
      monitor.setStatus(ClusterStatus.Inactive);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterTerminatingEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterTerminatingEvent clusterTerminatingEvent=(ClusterTerminatingEvent)event;
      String clusterId=clusterTerminatingEvent.getClusterId();
      String instanceId=clusterTerminatingEvent.getInstanceId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        ClusterStatusEventPublisher.sendClusterTerminatedEvent(clusterTerminatingEvent.getAppId(),clusterTerminatingEvent.getServiceName(),clusterId,instanceId);
        return;
      }
      if (monitor.getStatus() == ClusterStatus.Active) {
        monitor.setStatus(ClusterStatus.Terminating);
        InstanceNotificationPublisher.sendInstanceCleanupEventForCluster(clusterId);
      }
 else {
        monitor.setStatus(ClusterStatus.Terminating);
        monitor.terminateAllMembers();
      }
      ServiceReferenceHolder.getInstance().getClusterStatusProcessorChain().process("String_Node_Str",clusterId,instanceId);
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      log.info("String_Node_Str" + event.getClass());
      ClusterTerminatedEvent clusterTerminatedEvent=(ClusterTerminatedEvent)event;
      String clusterId=clusterTerminatedEvent.getClusterId();
      AutoscalerContext asCtx=AutoscalerContext.getInstance();
      AbstractClusterMonitor monitor;
      monitor=asCtx.getClusterMonitor(clusterId);
      if (null == monitor) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
        }
        ApplicationMonitor appMonitor=AutoscalerContext.getInstance().getAppMonitor(clusterTerminatedEvent.getAppId());
        if (appMonitor != null) {
          appMonitor.onChildStatusEvent(new ClusterStatusEvent(ClusterStatus.Terminated,clusterId,null));
        }
        return;
      }
      monitor.setStatus(ClusterStatus.Terminated);
      monitor.destroy();
      AutoscalerContext.getInstance().removeClusterMonitor(clusterId);
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberReadyToShutdownEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberReadyToShutdownEvent memberReadyToShutdownEvent=(MemberReadyToShutdownEvent)event;
        String clusterId=memberReadyToShutdownEvent.getClusterId();
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        AbstractClusterMonitor monitor;
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberReadyToShutdownEvent(memberReadyToShutdownEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberStartedEventListener(){
    @Override protected void onEvent(    Event event){
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberTerminatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberTerminatedEvent memberTerminatedEvent=(MemberTerminatedEvent)event;
        String clusterId=memberTerminatedEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberTerminatedEvent(memberTerminatedEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberActivatedEventListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberActivatedEvent memberActivatedEvent=(MemberActivatedEvent)event;
        String clusterId=memberActivatedEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberActivatedEvent(memberActivatedEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new MemberMaintenanceListener(){
    @Override protected void onEvent(    Event event){
      try {
        MemberMaintenanceModeEvent maintenanceModeEvent=(MemberMaintenanceModeEvent)event;
        String clusterId=maintenanceModeEvent.getClusterId();
        AbstractClusterMonitor monitor;
        AutoscalerContext asCtx=AutoscalerContext.getInstance();
        monitor=asCtx.getClusterMonitor(clusterId);
        if (null == monitor) {
          if (log.isDebugEnabled()) {
            log.debug(String.format("String_Node_Str" + "String_Node_Str",clusterId));
          }
          return;
        }
        monitor.handleMemberMaintenanceModeEvent(maintenanceModeEvent);
      }
 catch (      Exception e) {
        String msg="String_Node_Str" + e.getLocalizedMessage();
        log.error(msg,e);
      }
    }
  }
);
  topologyEventReceiver.addEventListener(new ClusterInstanceCreatedEventListener(){
    @Override protected void onEvent(    Event event){
      ClusterInstanceCreatedEvent clusterInstanceCreatedEvent=(ClusterInstanceCreatedEvent)event;
      AbstractClusterMonitor clusterMonitor=AutoscalerContext.getInstance().getClusterMonitor(clusterInstanceCreatedEvent.getClusterId());
      String instanceId=((ClusterInstanceCreatedEvent)event).getInstanceId();
      if (clusterMonitor != null) {
        TopologyManager.acquireReadLockForCluster(clusterInstanceCreatedEvent.getServiceName(),clusterInstanceCreatedEvent.getClusterId());
        try {
          Service service=TopologyManager.getTopology().getService(clusterInstanceCreatedEvent.getServiceName());
          if (service != null) {
            Cluster cluster=service.getCluster(clusterInstanceCreatedEvent.getClusterId());
            if (cluster != null) {
              try {
                if (cluster.isKubernetesCluster()) {
                  clusterMonitor.setClusterContext(ClusterContextFactory.getKubernetesClusterContext(instanceId,cluster));
                }
 else {
                  VMClusterContext clusterContext=(VMClusterContext)clusterMonitor.getClusterContext();
                  if (clusterContext == null) {
                    clusterMonitor.setClusterContext(ClusterContextFactory.getVMServiceClusterContext(instanceId,cluster));
                  }
 else {
                    clusterContext.addInstanceContext(instanceId,cluster);
                  }
                }
                if (clusterMonitor.hasMonitoringStarted().compareAndSet(false,true)) {
                  clusterMonitor.startScheduler();
                  log.info("String_Node_Str" + clusterInstanceCreatedEvent.getClusterId() + "String_Node_Str");
                }
              }
 catch (              PolicyValidationException e) {
                log.error(e.getMessage(),e);
              }
catch (              PartitionValidationException e) {
                log.error(e.getMessage(),e);
              }
            }
          }
 else {
            log.error("String_Node_Str" + clusterInstanceCreatedEvent.getServiceName() + "String_Node_Str"+ clusterInstanceCreatedEvent.getClusterId());
          }
        }
  finally {
          TopologyManager.releaseReadLockForCluster(clusterInstanceCreatedEvent.getServiceName(),clusterInstanceCreatedEvent.getClusterId());
        }
      }
 else {
        log.error("String_Node_Str" + clusterInstanceCreatedEvent.getClusterId());
      }
    }
  }
);
}