[jboss-cvs] JBossAS SVN: r58571 - trunk/cluster/src/main/org/jboss/ha/jndi
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Nov 18 06:31:55 EST 2006
Author: bstansberry at jboss.com
Date: 2006-11-18 06:31:54 -0500 (Sat, 18 Nov 2006)
New Revision: 58571
Modified:
trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingService.java
Log:
Use JBC 2 API
Can't query JMX for ClusterPartition class; it's a proxy now
Modified: trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingService.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingService.java 2006-11-18 11:30:50 UTC (rev 58570)
+++ trunk/cluster/src/main/org/jboss/ha/jndi/DetachedHANamingService.java 2006-11-18 11:31:54 UTC (rev 58571)
@@ -36,6 +36,7 @@
import java.rmi.MarshalledObject;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -45,9 +46,8 @@
import javax.management.QueryExp;
import javax.net.ServerSocketFactory;
-import org.jboss.cache.TreeCacheMBean;
+import org.jboss.cache.Cache;
import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.ha.framework.server.ClusterPartition;
import org.jboss.ha.framework.server.ClusterPartitionMBean;
import org.jboss.invocation.Invocation;
import org.jboss.invocation.MarshalledInvocation;
@@ -105,7 +105,7 @@
/**
* The cache used to store HA-JNDI bindings
*/
- protected TreeCacheMBean cache;
+ protected Cache cache;
/**
* The partition name used to lookup the HAPartition binding
*/
@@ -326,7 +326,7 @@
if (partition == null)
throw new IllegalStateException("Cannot find partition '" + partitionName + "'");
- cache = clusterPartition.getTreeCache();
+ cache = clusterPartition.getClusteredCache();
if (log.isDebugEnabled())
log.debug("Initializing HAJNDI server on partition: " + partitionName);
@@ -480,20 +480,34 @@
protected HAPartition findHAPartitionWithName(String name) throws Exception
{
HAPartition result = null;
- QueryExp exp = Query.and(Query.eq(Query.classattr(),
- Query.value(ClusterPartition.class.getName())),
- Query.match(Query.attr("PartitionName"),
- Query.value(name)));
+ // Class name match does not work with the AOP proxy :(
+// QueryExp classEQ = Query.eq(Query.classattr(),
+// Query.value(ClusterPartition.class.getName()));
+ QueryExp matchName = Query.match(Query.attr("Name"),
+ Query.value("ClusterPartition"));
+ QueryExp matchPartitionName = Query.match(Query.attr("PartitionName"),
+ Query.value(name));
+ QueryExp exp = Query.and(matchName, matchPartitionName);
+ Set mbeans = this.getServer().queryMBeans(null, exp);
+ if (mbeans != null && mbeans.size() > 0)
+ {
+ for (Iterator iter = mbeans.iterator(); iter.hasNext();)
+ {
+ ObjectInstance inst = (ObjectInstance) iter.next();
+ try
+ {
+ ClusterPartitionMBean cp =
+ (ClusterPartitionMBean) MBeanProxyExt.create(
+ ClusterPartitionMBean.class,
+ inst.getObjectName(),
+ this.getServer());
+ result = cp.getHAPartition();
+ break;
+ }
+ catch (Exception e) {}
+ }
+ }
- Set mbeans = this.getServer().queryMBeans(null, exp);
- if (mbeans != null && mbeans.size() > 0)
- {
- ObjectInstance inst = (ObjectInstance) (mbeans.iterator().next());
- ClusterPartitionMBean cp = (ClusterPartitionMBean) MBeanProxyExt.create(ClusterPartitionMBean.class,
- inst.getObjectName(),
- this.getServer());
- result = cp.getHAPartition();
- }
return result;
}
More information about the jboss-cvs-commits
mailing list