[jboss-cvs] JBossAS SVN: r107841 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 27 06:52:40 EDT 2010


Author: jaikiran
Date: 2010-08-27 06:52:40 -0400 (Fri, 27 Aug 2010)
New Revision: 107841

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
Log:
EJBTHREE-2046 Don't mandate the BeanInstantiator to be picked up from Ejb3Deployment. The singleton container doesn't use the Ejb3Deployment, so won't be able to pass that info

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-08-27 08:26:14 UTC (rev 107840)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-08-27 10:52:40 UTC (rev 107841)
@@ -206,7 +206,7 @@
    /**
     * Used to construct bean instances
     */
-   private final BeanInstantiator beanInstantiator;
+   protected BeanInstantiator beanInstantiator;
 
    private DependencyPolicy dependencyPolicy;
 
@@ -296,22 +296,27 @@
 
       initialContextProperties = ctxProperties;
 
+      // pull out some info from the deployment (if present)
       if(deployment != null)
+      {
+         // set the dependency policy
          this.dependencyPolicy = deployment.createDependencyPolicy(this);
+         
+         // Set the bean instantiator
+         final BeanInstantiator beanInstantiator = deployment.getBeanInstantiator();
+         if (beanInstantiator != null)
+         {
+            this.beanInstantiator = beanInstantiator;            
+         }
 
+      }
+
       Advisor advisor = getAdvisor();
       AdviceStack stack = advisor.getManager().getAdviceStack("InjectionCallbackStack");
       if(stack == null)
          throw new IllegalStateException("EJBTHREE-2020: No InjectionCallbackStack defined for domain " + domain + " of " + this);
       injectionCallbackStack = stack.createInterceptors(advisor, null);
       
-      // Set the bean instantiator
-      final BeanInstantiator beanInstantiator = deployment.getBeanInstantiator();
-      if (beanInstantiator == null)
-      {
-         throw new IllegalArgumentException(BeanInstantiator.class.getName() + " implementation must be supplied");
-      }
-      this.beanInstantiator = beanInstantiator;
    }
    
    /**
@@ -971,6 +976,12 @@
 
    public void create() throws Exception
    {
+      if (this.beanInstantiator == null)
+      {
+         throw new IllegalStateException("Bean instantiator hasn't been configured in container, for EJB named: "
+               + this.getEjbName());
+      }
+      
       // Blocking invocations until start()
       this.blockInvocations();
 
@@ -2010,4 +2021,9 @@
       interceptors.addAll(Arrays.asList(stack.createInterceptors(this.getAdvisor(), joinPoint)));
       return interceptors.toArray(new Interceptor[]{});
    }
+   
+   protected BeanInstantiator getBeanInstantiator()
+   {
+      return this.beanInstantiator;
+   }
 }



More information about the jboss-cvs-commits mailing list