2 Replies Latest reply on Sep 20, 2001 5:29 AM by lk

    For how long can EJBObject or EJBHome be held?

    lk

      I was wondering for how long time can my program hold references to EJBObject or EJBHome objects. Since I found that looking up the object (from Handle too) is the most time consuming operation I'd rather prefer to hold the entity bean's remote interface itself. Also, in my session beans I hold references to my entity beans' home interfaces as instance fields. I'm talking about holding those variables for hours or even days. Is this reasonable?

        • 1. Re: For how long can EJBObject or EJBHome be held?
          nhebert

          Lukasz,

          Home objects can be held as long as you want
          to after looking them up from JNDI as they do
          not go "stall". Of course if the container goes
          belly up, you are stuffed and get a remote exception
          when calling create()...

          This is a regular practice for me. If I need a
          stateless session bean, I obtain the Home and create()
          the remote once, up front. If it is a Stateful bean
          that I need I obtain the Home once and create() the
          remote on demand.

          You can certainly obtain the Home object for an
          Entity and hold on to that.

          Technically, Home and Remote objects can be
          serialised by a (Java) client to a persistant store
          and "reconstituted" later.

          Hope that helps.

          Cheers,

          Noel.

          • 2. Re: For how long can EJBObject or EJBHome be held?
            lk

            Do you mean that container restart invalidates all my home (not even mentioning the remote) interfaces?