How Handle can be used in Ejb apps? What's its significance?

47 Views Asked by At

I can see that Handle stores the reference to the beans. But how its useful for clients calling this ejb? What are the things that clients can achieve by getting the Handle to the ejb bean?

1

There are 1 best solutions below

0
On

In RMI-IIOP, a remote reference (stub) needs to be connected to an ORB instance to be usable. If you serialize and deserialize a stub yourself using ObjectOutputStream/ObjectInputStream to store in a file or database, then the deserialized stub will be disconnected, and attempting to use it will fail. If Handle and HomeHandle are serialized instead of the reference itself, then the EJB spec requires them to use the environment's HandleDelegate, which has a reference to the server's ORB instance, so the remote reference can be reconnected after deserialization.