0
votes

How EJB 2.0 Object handles (retrieved from getHandle() )help resuming after a disconnect from the server for Stateful Beans ??

In our application architecture, we are keeping the Handle of the stateful bean in a cache at the client side. If the the node in the cluster on which the Stateful bean was created goes down due to some reason, will the handle redirect the next call on the stateful to a new node ?? Is there any configuration that we can do if a Node goes down then reroute the calls on the Stateful Bean to another node in the cluster ??

1
This would rely on stateful session bean failover/replication. I don't know the specific details for WebLogic 10, but hopefully this gives a starting point for you to research if no one else provides an answer. - Brett Kail

1 Answers

0
votes

I can't tell you exactly how WebLogic handles failover for stateful beans, but EJB2 allows the server to permanently delete statfeul instances without warning - examples are if it's been inactive for a long time, or if there was a server crash. When this happens, if you call Handle.getEJBObject() you'll get a RemoteException.

From Head First EJB:

If you're shopping and you get a handle [discusses passivation]... if you still don't come back within some time period, the server will destroy your cart with no hope of resurrecting it. That bean is history. In that case, you cart won't be there when you call getEJBObject() on the handle, and you'll get a RemoteException.

So, it's definitely a possibility that the stateful bean your handle references disappears, and you should handle this exception in case any of those scenarios happen, although I can't say for sure whether a single node failure would cause it.