-
1. Re: jboss 7 How to get All ClusterNodes
jaysensharma Sep 4, 2012 5:02 AM (in response to bsudhananthan)Hi sudhananthan,
Please refer to the following link which has a JMX code sample in order to lest the Cluster Member details in JBoss AS7
http://middlewaremagic.com/jboss/?p=2428
Thanks
Jay SenSharma
-
2. Re: jboss 7 How to get All ClusterNodes
bsudhananthan Sep 4, 2012 7:36 AM (in response to jaysensharma)Thanks
In the link you specified contains example to retreve node information for specified host and port. But i need to get entire node information lists which falls under cluster.
In above jboss 5 code partition.getClusterNodes(); will return ClusterNode[ ] . So please anyone help me to get ClusterNodes info in jboss 7 .
-
3. Re: jboss 7 How to get All ClusterNodes
jaysensharma Sep 4, 2012 8:25 AM (in response to bsudhananthan)Hi,
The following attribute if invoked on any Cluster member (Which is part of cluster) then it will return the Whole Cluster view,. (Means the List of servers which are part of the cluster)
String webClusterObjectName=
"jgroups:type=channel,cluster=\"web\""
;
ObjectName objectName =
new
ObjectName(webClusterObjectName);
String clusterView = (String) connection.getAttribute(objectName,
"View"
);
Example:
[node2/web, node1/web]
-
4. Re: jboss 7 How to get All ClusterNodes
bsudhananthan Sep 4, 2012 10:07 AM (in response to jaysensharma)I got it pal.
Only view attribute will gives all the node names. All other attributes are specific to node through which JMXConnectorFactory connects.
For example my two server instance "server1" and "server2". I connect to "server1" to get all those details.
clusterView = [server1/web|1] [server1/web, server2/web]
receivedMessages = 9
name = server1/web
clusterName = web
So you can see only clusterView gives info of all the nodes in cluster and all other details are specific to node which i connected.
My output should contain nodename, ipaddress of all nodes that are connected to cluster (i.e one like org.jboss.as.clustering.ClusterNode).
-
5. Re: jboss 7 How to get All ClusterNodes
rhusar Sep 5, 2012 7:32 AM (in response to bsudhananthan)I personally dont like the JMX way very much, I find using Java directly is much nicer and as simple as:
Channel channel = (Channel) CurrentServiceContainer.getServiceContainer().getService(ServiceName.JBOSS.append("jgroups", "channel", "web")).getValue(); List<Address> members = channel.getView().getMembers(); log.log(Level.INFO, "Addresses: {0}.", members); HTH,
Rado