puzzled by EJBObject stub related

Discussions

General J2EE: puzzled by EJBObject stub related

  1. puzzled by EJBObject stub related (1 messages)

    Hi:
       I have been puzzled by EJBObject stub related.

    Q1: Does EJBObject stub is exist at the client side when compile the client application or retrieve from JNDI server at runtime?

    Q2: Does the EJBObject stub will automatic invalidated itself or need mannual to do it when remove() is called?


    Q3: Does the call getHandle() on EJBObject stub will retrieve the handle from EJB server or just get it from the stub?

    Thanks!
    Stive
  2. puzzled by EJBObject stub related[ Go to top ]

    The precise answers to your questions are server-dependent, but I can give you some general answers.

    A1: Typically, the stub object is created when the client first performs the JNDI lookup.

    A2: The stub will eventually time out and invalidate itself, but it is much more effecient to call "remove()" manually. This way the stub know when to invalidate itself and does not need to rely on timeouts. At least, call remove() for Session EJB; it has a different mean for Entity EJB (deleting the database row).

    A3: This is very situtation-dependent. As a rule, the EJB handle is probably derived from information in the stub, but I imagine some weird things can happen in clusted EJB environments or with Stateful Session EJBs, so I can't say this will be 100% true.