Howdy Ranchers!
I've just started entering the
EJB world and few questions raised in my head. Excuse me if these are obvious ones :-)
As I understand the ENC is a private scope for a concrete EJB.
So, can you say it's like the init-param's in the
servlets world?
Can a EJB A access the EJB's B ENC?
What is the relation between the ENC and JNDI? Is ENC a JNDI, is it a part of the JNDI or are these two entities unrelated with each other?
If I would like to have a scope where one EJB could take something from the other EJB - what should I use? Directly bind some entity in the JNDI and pass the location to another EJB or something else? Should the new EJB Singleton be used for such all EJB's common-space?
As I understand, every part of the application server can access some entry in the JNDI, so it's somewhat similar to the context-param (in contrast to the similarity of EJB's ENC <-> servlet's init-param)? By the way: is there a way to 'restrict' access to some resource in the JNDI? For example: EJB A and EJB B can access a resource in this JNDI location, but EJB C cannot access it.
Are the ENC parameters read only during deployment and CAN'T be changed at all after the deploy? I just was wandering that if it WOULD be possible to change the ENC value, you might end in an inconsistent EJB state.
I mean: I have a property marked with @Resource annotation which I inject with a value of "10". Container creates i.e. 5 instances of the EJB and put them in the pool. Then, somehow, I change the value of the ENC parameter to "20".
After this, container might decide to create few new EJB instances and add them to the pool. These new instances would have different property value injected ("20") and therefore I would end up with
x instances with property value of "10" and
y instances with property value of "20". As the container can choose which instance will be used to serve user's request, I would end in an inconsistent state of the EJB's.
Is this scenario even possible?
Thanks in advance for your time!
Cheers!