"andrew.saunders" wrote : The problem (for me at least) with HAMembershipListener is that the notification information it receives is of type ClusterNode which is basically at the JGroups level and not at the partition/node level. So it's a bunch of addresses/ports. | | Does anyone know a way of obtaining higher level information about topology changes? Or a reliable way of mapping the ClusterNode JGroups info to partition/node level info? | | The best I have been able to come up with so far is based on the fact that "normally" the default value of ClusterNode.getName() will be the address:port of the JNDI provider of the node that was added/removed. From here it's possible to obtain the remote MBeanServer and therefore any information about the node. BUT, this link is tenuous as it's dependent on an undocumented feature - not even in the javadoc - just buried in the source code. | | Any ideas for a reliable/supported alternative? You can use the following code snippet in your membershipChanged() implementation (gleaned from TopologyMonitorService) to get the InetAddress object that corresponds to the ClusterNode: org.jboss.ha.framework.interfaces.ClusterNode node = | (org.jboss.ha.framework.interfaces.ClusterNode)deadMembers.get(0); | InetAddress deadAddress = node.getOriginalJGAddress().getIpAddress(); Then, you can simply use the InetAddress methods to determine the hostname, IP address, etc. of the node that died (or use the other Vectors to determine the nodes that were added or the complete current membership roster for the cluster).
I actually just used the TopologyMonitorService to notify a custom MBean when the topology changes: <?xml version="1.0" encoding="UTF-8"?> | <!-- ===================================================================== --> | <!-- --> | <!-- Topology Monitor Service Configuration --> | <!-- --> | <!-- ===================================================================== --> | | <server> | | <classpath codebase="lib" archives="jbossha.jar"/> | | <mbean code="org.jboss.ha.framework.server.util.TopologyMonitorService" | name="Telematics:service=TopologyService"> | <attribute name="PartitionName">DefaultPartition</attribute> | <attribute name="TriggerServiceName">MyServer:service=MyTopologyManager</attribute> | <depends>MyServer:service=MyTopologyManager</depends> | </mbean> | | </server> My MBean (MyTopologyManager) simply implements the trigger method: /** | * Updates the distributed MBean registry based on cluster membership changes (dead servers are removed). | * | * @param deadMembers list of cluster members that have died | * | * @param newMembers list of cluster members that have joined | * | * @param allMembers list of all active cluster members | * | * @param logCategoryName log4j category name for logging messages | * | * @jmx.managed-operation | */ | public void membershipChanged(ArrayList deadMembers, ArrayList newMembers, | ArrayList allMembers, String logCategoryName) The ArrayLists contain org.jboss.ha.framework.server.util.TopologyMonitorService.AddressPort objects, which encapsulate the InetAddress and port of the affected node. <a href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825987#3825987">View the original post</a> <a href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825987>Reply to the post</a> ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
