[jboss-cvs] JBossAS SVN: r64129 - in trunk/cluster/src: main/org/jboss/ha/jmx and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 18 16:48:59 EDT 2007
Author: jerrygauth
Date: 2007-07-18 16:48:58 -0400 (Wed, 18 Jul 2007)
New Revision: 64129
Modified:
trunk/cluster/src/etc/deploy-hasingleton-beans.xml
trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBean.java
trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
Log:
JBAS-4277, HAServiceMBeanSupport supports classloader registration for RPC calls
Modified: trunk/cluster/src/etc/deploy-hasingleton-beans.xml
===================================================================
--- trunk/cluster/src/etc/deploy-hasingleton-beans.xml 2007-07-18 18:50:54 UTC (rev 64128)
+++ trunk/cluster/src/etc/deploy-hasingleton-beans.xml 2007-07-18 20:48:58 UTC (rev 64129)
@@ -40,6 +40,8 @@
<property name="targetStartMethodArgument">${jboss.server.home.url}deploy-hasingleton</property>
<property name="targetStopMethod">undeploySingletons</property>
<property name="targetStopMethodArgument">${jboss.server.home.url}deploy-hasingleton</property>
+ <!-- whether to register thread context classloader for the RPC handler, default is false -->
+ <!--<property name="registerThreadContextClassLoader">false</property>-->
</bean>
Modified: trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBean.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBean.java 2007-07-18 18:50:54 UTC (rev 64128)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBean.java 2007-07-18 20:48:58 UTC (rev 64129)
@@ -75,8 +75,26 @@
* @deprecated use {@link #setHAPartition(HAPartition)}
*/
void setClusterPartition(ClusterPartitionMBean clusterPartition);
+
+ /**
+ * Test whether the thread context classloader should be used in RPC calls.
+ *
+ * @return whether the thread context classloader should be used in RPC calls.
+ */
+ public boolean isRegisterThreadContextClassLoader();
+
+ /**
+ * Sets a flag specifying whether the calling thread's context classloader
+ * should be used when making RPC calls. This flag must be set before the
+ * RPC handler is registered in startService(). The default value is false.
+ * This would typically be used in conjunction with a scoped classloader.
+ *
+ * @param register whether to use the thread context classloader when
+ * registering the service's RPC handler.
+ *
+ */
+ public void setRegisterThreadContextClassLoader(boolean register);
-
/**
*
* Convenience method for broadcasting a call to all members of a partition.
@@ -114,8 +132,7 @@
*/
public void setDistributedState(String key, Serializable value)
throws Exception;
-
-
+
/**
*
* Broadcast the notification to the remote listener nodes (if any) and then
Modified: trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java 2007-07-18 18:50:54 UTC (rev 64128)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java 2007-07-18 20:48:58 UTC (rev 64129)
@@ -61,6 +61,7 @@
// Attributes ----------------------------------------------------
private HAPartition clusterPartition;
+ private boolean registerClassloader = false;
private DistributedReplicantManager.ReplicantListener drmListener = null;
@@ -103,6 +104,16 @@
{
return clusterPartition.getPartitionName();
}
+
+ public boolean isRegisterThreadContextClassLoader()
+ {
+ return registerClassloader;
+ }
+
+ public void setRegisterThreadContextClassLoader(boolean register)
+ {
+ registerClassloader = register;
+ }
// Protected ------------------------------
@@ -192,7 +203,10 @@
protected void registerRPCHandler()
{
- clusterPartition.registerRPCHandler(getServiceHAName(), this);
+ if (isRegisterThreadContextClassLoader())
+ clusterPartition.registerRPCHandler(getServiceHAName(), this, Thread.currentThread().getContextClassLoader());
+ else
+ clusterPartition.registerRPCHandler(getServiceHAName(), this);
}
protected void unregisterRPCHandler()
More information about the jboss-cvs-commits
mailing list