Caching Remote Reference of Stateless Bean

Discussions

EJB design: Caching Remote Reference of Stateless Bean

  1. Caching Remote Reference of Stateless Bean (4 messages)

    i m following the MVC and SessionFacade architecture,
    Can we cache the Remote reference of Stateless Bean ?
    will this make any overhead if application gets a huge amount of requests ..
    What will be the best solution to do this ?
     thanks in advance!!!!
  2. I think the Service Locator Pattern would be the answer. Please visit the following URL:
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html
  3. 1) after reading the reference link, it seems to me that handle of remote reference should be cached instead of the remote reference. am l correct ?

    2) if there are more than a client using the same cached remote / local home reference, will there be any synchronization problem ?

    thx a lot for your answer
  4. 1) Normally it is not much point to cache the remote reference of a Stateless SessionBean. SessionBean are generally tied to the lifetime of a given client session. They are relatively short-lived. If you really want, you can cache it in the ServiceLocator object.

    2) Usually Stateless SessionBean would act as agents modeling workflow or provide access to special transient business services, so synchronization should not be an issue even you cache the remote/home reference. But if you're doing that, you have to be careful and you may want to synchonize the business service that the SessionBean access.
  5. Ya !! it is perfectly alright that we can cache the Remote in the ServiceLocator .
    My Question is at its place...
    Will this Cache Remote Reference ,is used by the all application Clients ..
    n if Yes then it will effect the performance .