public static void handleClusterInstanceCreated( String serviceType, String clusterId, String alias, String instanceId, String partitionId, String networkPartitionId) { TopologyManager.acquireWriteLock(); try { Topology topology = TopologyManager.getTopology(); Service service = topology.getService(serviceType); if (service == null) { log.error( "Service " + serviceType + " not found in Topology, unable to update the cluster status to Created"); return; } Cluster cluster = service.getCluster(clusterId); if (cluster == null) { log.error( "Cluster " + clusterId + " not found in Topology, unable to update " + "status to Created"); return; } if (cluster.getInstanceContexts(instanceId) != null) { log.warn( "The Instance context for the cluster already exists for [cluster] " + clusterId + " [instance-id] " + instanceId); return; } ClusterInstance clusterInstance = new ClusterInstance(alias, clusterId, instanceId); clusterInstance.setNetworkPartitionId(networkPartitionId); clusterInstance.setPartitionId(partitionId); cluster.addInstanceContext(instanceId, clusterInstance); TopologyManager.updateTopology(topology); ClusterInstanceCreatedEvent clusterInstanceCreatedEvent = new ClusterInstanceCreatedEvent(serviceType, clusterId, clusterInstance); clusterInstanceCreatedEvent.setPartitionId(partitionId); TopologyEventPublisher.sendClusterInstanceCreatedEvent(clusterInstanceCreatedEvent); } finally { TopologyManager.releaseWriteLock(); } }