[Design the new POJO MicroContainer] - Re: expressing dependent states
by adrian@jboss.org
"jhalliday" wrote : Hmm, presumably injecting it as a parameter to some lifecycle method ensures the property has actually been configured correctly (ORBService may setORB(...) in e.g. startService()), whereas injecting it as a property on the bean does not. Property injection is built on the assumption that a bean's properties are initialized at bean creation time I guess? Besides, if I inject it as a property of my bean, I may be tempted to use it in create() rather than start(), which would be against the guidelines I think. So the correct approach would seem to be
|
No. "inject" is different from "depends".
The MC is a lot more flexible than the old service lifecycle.
In fact, the JBoss5 service lifecycle is more flexible than the old JBoss4 one. ;-)
depends is a two phase lifecycle create/start that is backwards compatible with
the old MBean service lifecycle.
The MBean lifecycle was originally done as two phase to solve circular dependency
issues (which most services don't have anyway ;-).
inject works by requiring the dependency is INSTALLED (i.e. it has completed its whole
lifecycle) before the object can be injected into the dependee.
Circular dependencies are handled in a different (more explicit) way in the MC,
see the getting started docs. i.e. You can override what state the dependency
must be in before it is injected.
e.g. You can inject an MBean instance or property into a constructor, propertly, lifecycle
method parameter, etc. and it will guarantee the MBean has been fully started before
that part of the lifecycle gets invoked.
There's a different philosophy between the two mechanisms.
ASIDE:
In JBoss5 MBeans have gained some (but not all) of this injection flexibility
from the ServiceController being implemented on top of the MC.
e.g. There is now a proper lifecycle for the setAttribute() invocations on the
mbeans so they can use "inject" semantics rather than "depends optional-attribute".
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152414#4152414
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152414
17 years, 10 months
[Design of EJB 3.0] - Re: JBMETA-42
by scott.stark@jboss.org
"wolfc" wrote : Patch #2 is a continuation of the first were I reverted the baseJndiName in JBossEnterpriseBeanMetaData. Subsequently I made it obsolete by introducing a JBossSessionPolicyDecorator which associates a JBossSessionBeanMetaData with a working JNDI binding policy.
| As can be seen in the jbmeta42 test this requires an extra step before the meta data is offered to the deployer, but it completely separates out the logic of JNDI name resolving while having it completely obscured to the deployer itself.
|
| Unit tests are passing 100%, but previously there was a possible issue with profile service storing the wrong data. Is that still the case in this setup?
The profile service would only store the non-XmlTransient values, so as long determineResolvedJndiName does not set something like the jndiName, mappedName, its not interfering with the administered view.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152385#4152385
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152385
17 years, 10 months