• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

ServiceLocator on the web tier and the EJB tier

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sun PetStore 1.4 demonstrates two difference ServiceLocator implementations for the web tier and the EJB tier:

com.sun.j2ee.blueprints.servicelocator.web.ServiceLocator
com.sun.j2ee.blueprints.servicelocator.ejb.ServiceLocator

The one for the web tier uses the "singleton" strategy and also the "caching" strategy.

I wonder that why we need two different implementations. Is there any problem if we use a single one implementation that uses a cache for both web tier and EJB tier?

Any help will be appreciated.

Stephen
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephen,

Not sure if I can help you much since I don�t remember much about PetStore application and the only thing I remember is that PetStore is probably one of the best examples proving that J2EE in general and Sun design patterns in particular are such low quality software solutions. This gave Microsoft the possibility to develop their .NET PetShop counterpart that uses 10 times less amount of code and performs several times better, while it provides the same functionality. It�s also funny when you think that were people trying to improve the PetStore app, but they used different patterns and practice that were forbidden by Sun. What a mess�
Hence my first advice to you would be to look somewhere else for design patterns and don�t take it very hard to understanding PetStore.
On the other hand, without pretending I�ll give you the right answer, one good reason to have two different service locators, is because the web tier has two possibilities: to access the ejbs through remote or local interfaces, depending upon the clustering architecture, or simply if the web server and ejb container runs in different jvms. As for the ejb service locator, it supposes to use always the local interfaces, since the application uses a session fa�ade.
Regards.
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic