Discussions

General J2EE: EJBHandle

  1. EJBHandle (3 messages)

    WHat is the use of EJBHandle its advantages and disadvantages.
    What does EJBHandle stores. Does it store a referenece of the EJBObject or the value.
    If it stores the ref and i deserialize the EJBHandle at later will it able to find the EJBObject.
    and how this will work in clustered environment

    Regards,
    aakash

    Threaded Messages (3)

  2. EJBHandle[ Go to top ]

    aakash:

      I am putting some of the snippets from EE api and specs. That shall explain u the handle in details.

    1. The Handle interface is implemented by all EJB object handles. A handle is an abstraction of a network reference to an EJB object. A handle is intended to be used as a "robust" persistent reference to an EJB object.

    2. Obtain a handle for the remote home interface. The home handle can be serialized and written to stable storage. Later, possibly in a different JVM, the handle can be deserialized from stable storage and used to obtain back a reference of the remote home interface.

    3. A session object handle can be held beyond the life of a client process by serializing the handle to persistent store. When the handle is later deserialized, the session object it returns will work as long as the session object still exists on the server. (An earlier timeout or server crash may have destroyed the session object.)

    4. Suppose that the end-user wishes to start the shopping session, suspend the shopping session temporarily for a day or two, and later complete the session. The client might implement this feature by getting the session object’s handle, saving the serialized handle in persistent storage, then using it later to
    reestablish access to the original Cart.


    Hence your query

    >>WHat is the use of EJBHandle its advantages and disadvantages.
    Handle only has advantages, itz giving the facility to persist a remote object and later load it as per ur needs.

    >>What does EJBHandle stores. Does it store a referenece of the EJBObject or the >>value.

    Handle object stores the cast of the object and the value attributes of the object. it need not have to store the refference. reason being itz all remote + pooled object thing, so one really doesnt know what object is getting attached to the refference.

    >>If it stores the ref and i deserialize the EJBHandle at later will it able to >>find the EJBObject.

    As said above it stores the value attributs and hence when u load the persisted object again it is put in to one of the instances.


    >>and how this will work in clustered environment

    Check point number 2. The hard copy of object is totaly detached from ur JVM and hence can be used anywhere within or outside JVM.



    Hope this helps
    Regards
  3. EJBHandle[ Go to top ]

    Thanks a lot for the reply..
  4. Re: EJBHandle[ Go to top ]

    Handle object stores the cast of the object and the value attributes of the object. it need not have to store the reference. reason being itz all remote + pooled object thing, so one really doesn't know what object is getting attached to the reference.
    When I read the specification, it means to me that the handle is just a persistent reference to an EJB Object. I'm not sure it keeps a copy of the values (like a kind of serialized Flyweight). In particular, when the spec says:
    When the handle is later deserialized, the session object it returns will work as long as the session object still exists on the server. (An earlier timeout or server crash may have destroyed the session object.)
    BenoƮt