[jboss-cvs] JBossAS SVN: r61666 - branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Mar 25 10:48:20 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-03-25 10:48:20 -0400 (Sun, 25 Mar 2007)
New Revision: 61666
Modified:
branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
Log:
[EJBTHREE-881] Store partition name in EJBContainer if clustered
Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-03-25 14:46:20 UTC (rev 61665)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-03-25 14:48:20 UTC (rev 61666)
@@ -51,6 +51,7 @@
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import org.jboss.annotation.ejb.Clustered;
import org.jboss.annotation.ejb.PoolClass;
import org.jboss.aop.AspectManager;
import org.jboss.aop.ClassContainer;
@@ -87,6 +88,7 @@
import org.jboss.metamodel.descriptor.EnvironmentRefGroup;
import org.jboss.naming.Util;
//import org.jboss.virtual.VirtualFile;
+import org.jboss.util.StringPropertyReplacer;
/**
* Comment
@@ -150,6 +152,8 @@
protected InvocationStatistics invokeStats = new InvocationStatistics();
+ private String partitionName;
+
/**
* @param name Advisor name
* @param manager Domain to get interceptor bindings from
@@ -458,6 +462,19 @@
{
return pool;
}
+
+ /**
+ * Gets the name of the cluster partition with which this container is
+ * associated. Not available until <code>EJBContainer.start()</code>
+ * is completed.
+ *
+ * @return the name of the cluster partition with which this container is
+ * associated, or <code>null</code> if the container is not clustered
+ */
+ public String getPartitionName()
+ {
+ return partitionName;
+ }
public Object construct()
{
@@ -531,6 +548,10 @@
createCallbackHandler();
JaccHelper.configureContainer(jaccContextId, this);
+
+ // If we're clustered, find our partition name
+ findPartitionName();
+
log.info("STARTED EJB: " + clazz.getName() + " ejbName: " + ejbName);
}
@@ -671,6 +692,34 @@
log.debug("All applicable interceptor classes: " + applicableInterceptors);
}
}
+
+ protected void findPartitionName()
+ {
+ Clustered clustered = (Clustered) resolveAnnotation(Clustered.class);
+ if (clustered == null)
+ {
+ partitionName = null;
+ return;
+ }
+
+ String value = clustered.partition();
+ try
+ {
+ String replacedValue = StringPropertyReplacer.replaceProperties(value);
+ if (value != replacedValue)
+ {
+ log.debug("Replacing @Clustered partition attribute " + value + " with " + replacedValue);
+ value = replacedValue;
+ }
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to replace @Clustered partition attribute " + value +
+ ". Caused by " + e.getClass() + " " + e.getMessage());
+ }
+
+ partitionName = value;
+ }
public Object getBusinessObject(BeanContext beanContext, Class businessObject) throws IllegalStateException
{
More information about the jboss-cvs-commits
mailing list