Skip to content

Instantly share code, notes, and snippets.

@nshaw
Created January 28, 2013 15:47
Show Gist options
  • Select an option

  • Save nshaw/4656615 to your computer and use it in GitHub Desktop.

Select an option

Save nshaw/4656615 to your computer and use it in GitHub Desktop.
Display the details of nodes visible to a cluster.
import com.liferay.portal.kernel.cluster.ClusterExecutorUtil
import com.liferay.portal.kernel.cluster.ClusterNode
try {
println "Clustering enabled: " + ClusterExecutorUtil.isEnabled()
List<ClusterNode> nodes = ClusterExecutorUtil.getClusterNodes()
println "Number of nodes: " + nodes.size()
for (ClusterNode node : nodes) {
println node.getHostName() + "," +
node.getInetAddress() + "," +
node.getPort() + "," +
node.getClusterNodeId()
}
}
catch (Exception e) {
println e.getMessage()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment