[jboss-cvs] JBossAS SVN: r64285 - in branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3: remoting and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 25 21:16:29 EDT 2007
Author: bdecoste
Date: 2007-07-25 21:16:28 -0400 (Wed, 25 Jul 2007)
New Revision: 64285
Modified:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Registry.java
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/remoting/ClusteredIsLocalInterceptor.java
Log:
[EJBTHREE-1019] potential fix for clustering failures - check for oid container for failover
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Registry.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Registry.java 2007-07-26 00:11:34 UTC (rev 64284)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Registry.java 2007-07-26 01:16:28 UTC (rev 64285)
@@ -40,13 +40,14 @@
private static final Logger log = Logger.getLogger(Ejb3Registry.class);
private static Map<String, Container> containers = new HashMap<String, Container>();
+ private static Map<String, Container> clusterContainers = new HashMap<String, Container>();
private static final VMID VMID = new VMID();
/**
* Find a potential container.
*
- * @param oid the canonical object name of the container
+ * @param guid the GUID
* @return the container or null if not found
*/
public static Container findContainer(String guid)
@@ -57,7 +58,7 @@
/**
* Reports the existance of a container.
*
- * @param oid the canonical object name of the container
+ * @param guid the GUID
* @return true if found, false otherwise
*/
public static boolean hasContainer(String guid)
@@ -67,9 +68,14 @@
public static final String guid(Container container)
{
- return container.getObjectName().getCanonicalName() + "-" + VMID;
+ return container.getObjectName().getCanonicalName() + ",VMID=" + VMID;
}
+ private static final String oid(Container container)
+ {
+ return container.getObjectName().getCanonicalName();
+ }
+
/**
* Registers a container.
*
@@ -82,6 +88,7 @@
if(hasContainer(guid))
throw new IllegalStateException("Container " + guid + " + is already registered");
containers.put(guid, container);
+ clusterContainers.put(oid(container), container);
}
/**
@@ -99,10 +106,10 @@
}
/**
- * Returns the container specified by the given canocical object name.
+ * Returns the container specified by the given GUID.
* Never returns null.
*
- * @param oid the canonical object name of the container
+ * @param guid the GUID
* @return the container
* @throws IllegalStateException if the container is not registered
*/
@@ -110,8 +117,26 @@
{
if(!hasContainer(guid))
throw new IllegalStateException("Container " + guid + " is not registered");
+
return containers.get(guid);
}
+
+ /**
+ * Returns the container specified by the given canocical object name.
+ * Never returns null.
+ *
+ * @param oid the canonical object name of the container
+ * @return the container
+ * @throws IllegalStateException if the container is not registered
+ */
+ public static Container getClusterContainer(String oid)
+ {
+ Container container = clusterContainers.get(oid);
+ if(container == null)
+ throw new IllegalStateException("Container " + oid + " is not registered");
+
+ return container;
+ }
/**
* Returns an unmodifiable collection of the registered containers.
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/remoting/ClusteredIsLocalInterceptor.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/remoting/ClusteredIsLocalInterceptor.java 2007-07-26 00:11:34 UTC (rev 64284)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/remoting/ClusteredIsLocalInterceptor.java 2007-07-26 01:16:28 UTC (rev 64285)
@@ -61,7 +61,12 @@
Container container = null;
try
{
- container = Ejb3Registry.getContainer(guid);
+ container = Ejb3Registry.findContainer(guid);
+ if (container == null)
+ {
+ String oid = (String)invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
+ container = Ejb3Registry.getClusterContainer(oid);
+ }
}
catch (IllegalStateException ignored)
{
More information about the jboss-cvs-commits
mailing list