[jboss-cvs] JBossAS SVN: r110174 - trunk/ejb3/src/main/java/org/jboss/ejb3/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 23 08:28:47 EST 2010
Author: jaikiran
Date: 2010-12-23 08:28:46 -0500 (Thu, 23 Dec 2010)
New Revision: 110174
Modified:
trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
Log:
JBAS-8548 Final pieces of switchboard integration for ServiceContainer
Modified: trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java
===================================================================
--- trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2010-12-23 12:23:16 UTC (rev 110173)
+++ trunk/ejb3/src/main/java/org/jboss/ejb3/deployers/Ejb3JBoss5Deployment.java 2010-12-23 13:28:46 UTC (rev 110174)
@@ -46,6 +46,7 @@
import org.jboss.ejb3.javaee.JavaEEApplication;
import org.jboss.ejb3.javaee.JavaEEComponent;
import org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin;
+import org.jboss.ejb3.service.ServiceContainer;
import org.jboss.injection.injector.EEInjector;
import org.jboss.injection.injector.metadata.EnvironmentEntryType;
import org.jboss.injection.injector.metadata.InjectionTargetType;
@@ -160,7 +161,7 @@
}
// add dependency on START (and not INSTALLED) state of Switchboard, since the container only requires a fully populated ENC context,
// but doesn't require a invokable context. An invokable context is only needed by Injector.
- dependsPolicy.addDependency(this.createSwitchBoardDependency(switchBoard));
+ dependsPolicy.addDependency(this.createSwitchBoardDependency(ejbContainer, switchBoard));
log.debug("Added dependency on Switchboard " + switchBoard.getId() + " for EJB container " + ejbContainer.getName());
@@ -397,15 +398,31 @@
return false;
}
- private DemandMetaData createSwitchBoardDependency(Barrier switchBoard)
+ private DemandMetaData createSwitchBoardDependency(EJBContainer container, Barrier switchBoard)
{
AbstractDemandMetaData switchboardDependency = new AbstractDemandMetaData();
switchboardDependency.setDemand(switchBoard.getId());
switchboardDependency.setWhenRequired(ControllerState.CREATE);
- // container requires only a populated ENC (== START state of switchboard)
- switchboardDependency.setTargetState(ControllerState.START);
+ // This is really hacky for @Service bean containers.
+ // The issue with ServiceContainer is that it instantiates (and that leads to injection)
+ // the bean instance in its start() lifecycle call. Ideally, like the @Singleton EJB3.1 beans
+ // we should have done it outside of the container, so that the container could just depend
+ // on a START(ed) switchboard which provides only a populated but not invokable ENC.
+ // However, due to the nature of changes involved to support that for @Service and given that
+ // we have deprecated @Service (starting AS6), this is relatively better way to handle @Service
+ // beans.
+ if (container instanceof ServiceContainer)
+ {
+ // ServiceContainer requires a populated and invokable ENC (== INSTALLED state of switchboard)
+ switchboardDependency.setTargetState(ControllerState.INSTALLED);
+ }
+ else
+ {
+ // container requires only a populated ENC (== START state of switchboard)
+ switchboardDependency.setTargetState(ControllerState.START);
+ }
return switchboardDependency;
}
-
+
}
More information about the jboss-cvs-commits
mailing list