[jboss-cvs] JBossAS SVN: r111288 - branches/JBPAPP_5_1_0_Final_JBPAPP-6433/server/src/main/org/jboss/invocation.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 2 19:24:56 EDT 2011
Author: bmaxwell
Date: 2011-05-02 19:24:56 -0400 (Mon, 02 May 2011)
New Revision: 111288
Modified:
branches/JBPAPP_5_1_0_Final_JBPAPP-6433/server/src/main/org/jboss/invocation/InvokerInterceptor.java
Log:
[JBPAPP-6433] added change to check cluster partition when -Dorg.jboss.invocation.use.partition.name=true
Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-6433/server/src/main/org/jboss/invocation/InvokerInterceptor.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-6433/server/src/main/org/jboss/invocation/InvokerInterceptor.java 2011-05-02 14:17:00 UTC (rev 111287)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-6433/server/src/main/org/jboss/invocation/InvokerInterceptor.java 2011-05-02 23:24:56 UTC (rev 111288)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -68,6 +69,12 @@
/** The InvokerProxyHA class */
protected static Class invokerProxyHA;
+
+ // JBPAPP-6428 when determining isLocal, if this is true take into account the cluster partition name
+ private static final boolean isLocalCheckPartitionName = Boolean.parseBoolean( System.getProperty("org.jboss.invocation.use.partition.name", "false") );
+ // JBPAPP-6428 - these are static variables to cache the reflection methods needed for JBPAPP-6428
+ private static Method getFamilyClusterInfo;
+ private static Method getFamilyName;
static
{
@@ -145,10 +152,54 @@
return false;
}
+ // JBPAPP-6428 - EJB2 InvokerInterceptor isLocal returns true when it should return false
+ // Only check the cluster names if it is clustered
+ if (isLocalCheckPartitionName == true)
+ {
+ if (isClustered(invocation) == true)
+ {
+ try
+ {
+ String containerPartitionName = System.getProperty("jboss.partition.name");
+
+ Object invokerProxyHA = invocation.getInvocationContext().getInvoker();
+
+ // reflection to org.jboss.invocation.InvokerProxyHA.getFamilyClusterInfo().getFamilyName()
+ String destinationPartitionName = getFamilyName(invokerProxyHA);
+
+ if (containerPartitionName != null)
+ {
+ if (! destinationPartitionName.startsWith(containerPartitionName + "/"))
+ return false;
+ }
+ }
+ // Catch any reflection exception - which should not occur since isClustered == true
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ // end JBPAPP-6428
+
// See whether we have a local target
return hasLocalTarget(invocation);
}
+ private String getFamilyName(Object invokerProxyHA) throws Exception
+ {
+ if(getFamilyClusterInfo == null)
+ getFamilyClusterInfo = invokerProxyHA.getClass().getMethod("getFamilyClusterInfo", new Class[0]);
+
+ Object familyClusterInfo = getFamilyClusterInfo.invoke(invokerProxyHA, new Object[0]);
+
+ if(getFamilyName == null)
+ getFamilyName = familyClusterInfo.getClass().getMethod("getFamilyName", new Class[0]);
+
+ return (String) getFamilyName.invoke(familyClusterInfo, new Object[0]);
+ }
+
+
/**
* Whether we are in a clustered environment<p>
*
More information about the jboss-cvs-commits
mailing list