Discussions

EJB design: HELP: can l make datasource/ejb home handler object shareable ?

  1. all ejb guru

    As far as l know, it is general rule of thumb to cache the EJB home handlers and datasource object at EJB bean instance. But can l go a step further, make the same instance of EJB home handlers and datasource object shared by more than 1 EJB bean instance ?

    ( l checked out the methods of javax.ejb.EJBhome and javax.sql.DataSource. They are not declared as synchronized. It seems to me that EJB home handlers and datasource object are not thread safe and not suitable for being shared. Even they are thread-safe, if they are shared by 1+ EJB bean instance. Sharing EJB home handlers and datasource object may interfere the thread management of EJB container. Am l correct ? )

    It is highly appreciated someone can share with me your insight in this issue.

    thanks & regards
    Danny
  2. how about storing them as JNDI look up objects.....?