dcsimg
Question about cached service locator pattern posted at sun and javaworld
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ah_So
Posted On:   Thursday, August 15, 2002 06:58 PM

Hi all j2ee/ejb guru The article(http://www.javaworld.com/javaworld/jw-07-2002/jw-0703-service.html) posted at javaworld about service locator pattern seemingly go a step further than that posted at sun (http://developer.java.sun.com/developer/restricted/patterns/ServiceLocator.html) The overhead of locating ejb home handle / jdbc datasource seems further reduced by the virtue of caching previously located ejb home handle, jdbc datasource..etc. However, l have a couple of questions about the cached approach. 1) Seemingly, it stands a quite high chance a cached EJB home handler / datasource returned in this fashion may be referenced / invoked by more than one   More>>

Hi all j2ee/ejb guru




The article(http://www.javaworld.com/javaworld/jw-07-2002/jw-0703-service.html)
posted at javaworld about service locator pattern seemingly go a step further
than that posted at sun (http://developer.java.sun.com/developer/restricted/patterns/ServiceLocator.html)
The overhead of locating ejb home handle / jdbc datasource seems further reduced
by the virtue of caching previously located ejb home handle, jdbc datasource..etc.
However, l have a couple of questions about the cached approach.





1) Seemingly, it stands a quite high chance a cached EJB home handler / datasource
returned in this fashion may be referenced / invoked by more than one java class instances
such as ejb bean instances, javabean helper classes at either ejb or web tier.
l am just concerned about how the cached home handle and datasource returned by
service locator deal with concurrent calls arriving at the same time.
l wonder whether jdbc datasource / ejb home handle can handle it in thread-safe manner ?.
If not so, does it means datasource / ejb home handle should not be cached and returned
to 1+ class instances





2) Even it is thread-safe, as you see, the EJB home handle and datasource implementation
are provided by EJB container and db vendor respectively. Is the assumption about "thread-safe" nature
dependent on the vendors's implementation ?





3) Has J2EE/EJB spec explicitly specify the requirement of implementation of
jdbc datasource / ejb home handle ? Has the spec explicitly specify how should
they handle concurrent invocations arriving at the same time (it seems that
it is not a must for jdbc datasource / ejb home handle to be non-reentrant)





4) Even ejb container is smart enough to deal with concurrent calls arriving at
datasource / ejb home handle, how does it handle it?
Will the calls be handled in a serialized manner?
If so, it sounds a bit inefficient.






It is highly appreciated some ejb/j2ee veteran can offer their insight in above
questions / this design pattern





thx & regards


dso
.

   <<Less
About | Sitemap | Contact