[jboss-cvs] JBossAS SVN: r72703 - in trunk: cluster/src/main/org/jboss/ha/framework/server and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 24 16:43:04 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-04-24 16:43:03 -0400 (Thu, 24 Apr 2008)
New Revision: 72703
Modified:
trunk/aspects/src/main/org/jboss/aspects/remoting/ClusteredRemoting.java
trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
trunk/cluster/src/main/org/jboss/ha/framework/server/util/DistributedTimedCachePolicy.java
trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorService.java
trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorServiceMBean.java
trunk/cluster/src/main/org/jboss/invocation/http/server/HttpProxyFactoryHA.java
trunk/cluster/src/main/org/jboss/proxy/ejb/ProxyFactoryHA.java
trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java
trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java
trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
Log:
[JBAS-5440] Replace JNDI lookups of HAPartition with HAPartitionLocator
Modified: trunk/aspects/src/main/org/jboss/aspects/remoting/ClusteredRemoting.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aspects/remoting/ClusteredRemoting.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/aspects/src/main/org/jboss/aspects/remoting/ClusteredRemoting.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -33,12 +33,11 @@
import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
import org.jboss.ha.framework.interfaces.ClusteringTargetsRepository;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.ha.framework.server.HATarget;
import org.jboss.logging.Logger;
import org.jboss.remoting.InvokerLocator;
-import javax.naming.InitialContext;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -56,7 +55,7 @@
throws Exception
{
String proxyFamilyName = objectId.toString() + locator.getProtocol() + partitionName;
- HAPartition partition = (HAPartition) new InitialContext().lookup("/HAPartition/" + partitionName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
HATarget target = null;
Map families = null;
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -318,11 +318,15 @@
// Start the asynch listener handler thread
asynchHandler.start();
+ // Register with the service locator
+ HAPartitionLocator.getHAPartitionLocator().registerHAPartition(this);
+
// Bind ourself in the public JNDI space if configured to do so
if (bindIntoJndi)
{
Context ctx = new InitialContext();
- this.bind("/HAPartition/" + getPartitionName(), this, ClusterPartition.class, ctx);
+ this.bind(HAPartitionLocator.getStandardJndiBinding(getPartitionName()),
+ this, ClusterPartition.class, ctx);
log.debug("Bound in JNDI under /HAPartition/" + getPartitionName());
}
}
@@ -371,7 +375,7 @@
if (bindIntoJndi)
{
- String boundName = "/HAPartition/" + getPartitionName();
+ String boundName = HAPartitionLocator.getStandardJndiBinding(getPartitionName());
InitialContext ctx = null;
try
{
@@ -389,6 +393,8 @@
}
NonSerializableFactory.unbind (boundName);
}
+
+ HAPartitionLocator.getHAPartitionLocator().deregisterHAPartition(this);
log.info("Partition " + getPartitionName() + " stopped.");
}
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/util/DistributedTimedCachePolicy.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/util/DistributedTimedCachePolicy.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/util/DistributedTimedCachePolicy.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -26,10 +26,10 @@
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
-import javax.naming.InitialContext;
import org.jboss.ha.framework.interfaces.DistributedState;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.logging.Logger;
import org.jboss.util.CachePolicy;
@@ -134,9 +134,7 @@
public void create() throws Exception
{
// Lookup the parition
- InitialContext ctx = new InitialContext();
- String jndiName = "/HAPartition/" + partitionName;
- HAPartition partition = (HAPartition) ctx.lookup(jndiName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
this.entryMap = partition.getDistributedStateService();
log.debug("Obtained DistributedState from partition="+partitionName);
now = System.currentTimeMillis();
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorService.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorService.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorService.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -30,6 +30,7 @@
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.framework.interfaces.HAPartition.AsynchHAMembershipListener;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.system.ServiceMBeanSupport;
import org.jboss.system.server.ServerConfigUtil;
import org.jboss.logging.Logger;
@@ -93,12 +94,15 @@
{
}
-// --- Begin ServiceMBeanSupport overriden methods
+ // --- Begin ServiceMBeanSupport overriden methods
+
+
protected void startService() throws Exception
{
- InitialContext ctx = new InitialContext();
- String partitionJndiName = "/HAPartition/" + partitionName;
- partition = (HAPartition) ctx.lookup(partitionJndiName);
+ if (partition == null)
+ {
+ partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
+ }
// Register as a listener of cluster membership changes
partition.registerMembershipListener(this);
log.info("Registered as MembershipListener");
@@ -122,13 +126,18 @@
// --- Begin TopologyMonitorServiceMBean interface methods
public String getPartitionName()
{
- return partitionName;
+ return (partition == null ? partitionName : partition.getPartitionName());
}
public void setPartitionName(String name)
{
this.partitionName = name;
}
+ public void setPartition(HAPartition partition)
+ {
+ this.partition = partition;
+ }
+
public ObjectName getTriggerServiceName()
{
return triggerServiceName;
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorServiceMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorServiceMBean.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/util/TopologyMonitorServiceMBean.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -23,6 +23,8 @@
import java.util.Vector;
import javax.management.ObjectName;
+
+import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.system.ServiceMBean;
/** A utility mbean that monitors membership of a cluster parition
@@ -31,13 +33,23 @@
*/
public interface TopologyMonitorServiceMBean extends ServiceMBean
{
- /** Get the cluster parition name the mbean is monitoring
+ /**
+ * Get the name of the cluster partition the mbean is monitoring
*/
public String getPartitionName();
- /** Set the cluster parition name the mbean is monitoring
+
+ /**
+ * Set the cluster parition name the mbean is monitoring
+ *
+ * @deprecated use {@link #setPartition(HAPartition)}
*/
public void setPartitionName(String name);
+ /**
+ * Set the cluster partition the mbean is monitoring
+ */
+ public void setPartition(HAPartition partition);
+
/** Get the trigger mbean to notify on cluster membership changes
*/
public ObjectName getTriggerServiceName();
Modified: trunk/cluster/src/main/org/jboss/invocation/http/server/HttpProxyFactoryHA.java
===================================================================
--- trunk/cluster/src/main/org/jboss/invocation/http/server/HttpProxyFactoryHA.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/invocation/http/server/HttpProxyFactoryHA.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -27,7 +27,6 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.MBeanServer;
-import javax.naming.InitialContext;
import org.jboss.invocation.Invoker;
import org.jboss.invocation.InvokerInterceptor;
@@ -36,6 +35,7 @@
import org.jboss.system.server.ServerConfigUtil;
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.ha.framework.server.HATarget;
/** An extension of HttpProxyFactory that supports clustering of invoker proxies.
@@ -132,8 +132,7 @@
*/
protected Invoker createInvoker() throws Exception
{
- InitialContext iniCtx = new InitialContext();
- HAPartition partition = (HAPartition) iniCtx.lookup("/HAPartition/" + partitionName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
/* Create a HATarget for the local invoker mbean stub. The name passed
to the HATarget must be the wrappedJmxInvokerName so that different
Modified: trunk/cluster/src/main/org/jboss/proxy/ejb/ProxyFactoryHA.java
===================================================================
--- trunk/cluster/src/main/org/jboss/proxy/ejb/ProxyFactoryHA.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/cluster/src/main/org/jboss/proxy/ejb/ProxyFactoryHA.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -30,6 +30,7 @@
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.ha.framework.server.HATarget;
import javax.management.AttributeChangeNotificationFilter;
@@ -103,8 +104,7 @@
protected void setupInvokers() throws Exception
{
String partitionName = container.getBeanMetaData().getClusterConfigMetaData().getPartitionName();
- InitialContext ctx = new InitialContext();
- HAPartition partition = (HAPartition) ctx.lookup("/HAPartition/" + partitionName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
this.drm = partition.getDistributedReplicantManager ();
replicantName = jmxName.toString ();
@@ -133,7 +133,9 @@
clazz = cl.loadClass(container.getBeanMetaData().getClusterConfigMetaData().getHomeLoadBalancePolicy());
policy = (LoadBalancePolicy)clazz.newInstance();
homeInvoker = jrmp.createProxy(jmxName, policy, clusterFamilyName + "H");
+
// (Re-)Bind the home invoker in the JNDI naming space
+ InitialContext ctx = new InitialContext();
String homeName = jndiBinding + "-HomeInvoker";
log.debug("(re-)Binding Home invoker under: " + homeName);
Util.rebind(ctx,
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/drm/DRMUser.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -24,11 +24,11 @@
import java.io.Serializable;
import java.util.List;
import javax.management.Notification;
-import javax.naming.InitialContext;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
import org.jboss.ha.framework.interfaces.DistributedReplicantManager.ReplicantListener;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.logging.Logger;
import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
@@ -70,9 +70,7 @@
public void start() throws Exception
{
// Lookup the parition
- InitialContext ctx = new InitialContext();
- String jndiName = "/HAPartition/" + partitionName;
- HAPartition partition = (HAPartition) ctx.lookup(jndiName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
drm = partition.getDistributedReplicantManager();
log.debug("Obtained DistributedReplicantManager from partition="+partitionName);
drm.registerListener(category, this);
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/ds/DistributedStateUser.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -25,11 +25,11 @@
import java.util.Collection;
import java.util.Iterator;
import javax.management.Notification;
-import javax.naming.InitialContext;
import org.jboss.ha.framework.interfaces.DistributedState;
import org.jboss.ha.framework.interfaces.DistributedState.DSListenerEx;
import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.server.HAPartitionLocator;
import org.jboss.logging.Logger;
import org.jboss.mx.util.JBossNotificationBroadcasterSupport;
@@ -72,9 +72,7 @@
public void start() throws Exception
{
// Lookup the partition
- InitialContext ctx = new InitialContext();
- String jndiName = "/HAPartition/" + partitionName;
- HAPartition partition = (HAPartition) ctx.lookup(jndiName);
+ HAPartition partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(partitionName, null);
this.entryMap = partition.getDistributedStateService();
log.debug("Obtained DistributedState from partition="+partitionName);
entryMap.registerDSListenerEx(category, this);
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java 2008-04-24 20:10:13 UTC (rev 72702)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/hapartition/rpc/RPCUser.java 2008-04-24 20:43:03 UTC (rev 72703)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.cluster.hapartition.rpc;
-import javax.naming.InitialContext;
import java.util.ArrayList;
import java.util.GregorianCalendar;
@@ -38,7 +37,6 @@
public class RPCUser extends ServiceMBeanSupport implements RPCUserMBean
{
protected static Logger log = Logger.getLogger(RPCUser.class);
- private static final String JNDI_PARTITION = "/HAPartition/";
private static final String METHOD_GET_PERSON = "getPerson";
private static final String METHOD_GET_PERSON_MATCH = "getPersonMatch";
private static final String METHOD_NOTIFY_PERSON = "notifyPerson";
More information about the jboss-cvs-commits
mailing list