Discussions

EJB design: diff b/w service locator and EJBHomeFactory pattern

  1. What is the difference between a service locator pattern and EJBHomeFactory pattern?

    To my understanding both caches the EJBHome object to reduce to overhead involved in continous lookup of EJBHome.
    Then why do have two patterns...? can any one help me understanding this?
  2. It is not unusual to have two pattern names describing the same basic thing. There is no central "Pattern Standard Body", and frequently members of the programming community come up with the same idea, but give it a different name:

    Value Objects and Data Transfer Objects
    Inversion of Control and Dependency Injection

    And many others ...
  3. Hi Senthil,
           Looks like Service locator pattern was designed for more than just EJB Home look up/caching..it may be also used to look up JMS components etc

    http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html

    Raj.
  4. What is the difference between a service locator pattern and EJBHomeFactory pattern?To my understanding both caches the EJBHome object to reduce to overhead involved in continous lookup of EJBHome.Then why do have two patterns...? can any one help me understanding this?
    Service locator as name indicates is a locator cache for JNDI looked up services / for that matter any service who lookup is costly. One specific application for that pattern in J2EE world is EJB Home lookup.

    -Sanjay