-
1. Re: ServiceLocator pattern - delegates in the context of EJB
alesj Jan 24, 2007 5:38 PM (in response to javaneze)"javaneze" wrote:
At the moment I am just doing JNDI calls from my web layer...and its a bit lame..
Lame in what way?
Why the need for ServiceLocator, what do you gain?
EJB3 simplified things so much that a simple JNDI look-up of wanted EJB session bean (interface) is all you need. -
2. Re: ServiceLocator pattern - delegates in the context of EJB
jc7442 Jan 31, 2007 4:32 AM (in response to javaneze)Sometime I have to use a service locator like because I am in a class that is not a EJB3.
A small example:
Some of my entities have a @EntityListener. Implementation of the entity listener needs to use a service provided by an EJB3 session. In the source code of the entity listener, I can not use @EJB annotations (not supported). Consequently I use a ServiceLocator to get my session bean.
I'm not very happy with that but I have not found a better solution. In there something simpler in EJB3 ? -
3. Re: ServiceLocator pattern - delegates in the context of EJB
javaneze Jan 31, 2007 3:12 PM (in response to javaneze)Thank you for your replies!
The need of service locator was to hide the multiple JNDI calles and in EJB2.x to cache the interfaces so that you would not have to 'ask' it every time you need a common used EJB reference.
I am bit confused how we can achieve this kind of caching! or maybe is this caching necessary in EJB3 or the container now does greater magic..trying to optimize the whole thing!
I know service locator is not rocket science my app now runs perfect with plain JNDI calls..though I come from a EJb2.x background and it used to be a heavily used pattern.. -
4. Re: ServiceLocator pattern - delegates in the context of EJB
jc7442 Feb 1, 2007 3:16 AM (in response to javaneze)Another thread about service locator:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=97959 -
5. Re: ServiceLocator pattern - delegates in the context of EJB
alrubinger Feb 1, 2007 12:36 PM (in response to javaneze)"alesj" wrote:
Lame in what way?
Why the need for ServiceLocator, what do you gain?
Lame in the way that the EJB3 Spec allowed intracontainer injection of dependencies; why not provide the same utility to client applications? And in the process...abstract the inner plumbing of JNDI Lookups, naming exceptions, etc.
The JEE5 Application Clients spec doesn't quite fill these needs; doesn't provide for more than one Service Provider, no caching of SLSB and JMX Stubs, etc.
I'm really hoping to have some time to invest in this when things at my day job cool a bit. I'd love for a public Service Locator integrated w/ the new injection framework.
So will post back when I'm able to commit something of worth.
S,
ALR