• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Session Bean Handle question

 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if getEJBObject() is called on a Handle, but the bean has been removed by the container due to time-out? Let us assume that the Handle is able to establish a connection to the server successfully.

HFEJB, Pg: 140 says that a RemoteException will be thrown.

My understanding from the spec is that java.rmi.NoSuchObjectException (and NOT RemoteException) will be thrown.

Am I right?
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Keerthi P:
What happens if getEJBObject() is called on a Handle, but the bean has been removed by the container due to time-out? Let us assume that the Handle is able to establish a connection to the server successfully.

HFEJB, Pg: 140 says that a RemoteException will be thrown.

My understanding from the spec is that java.rmi.NoSuchObjectException (and NOT RemoteException) will be thrown.

Am I right?



I believe that java.rmi.NoSuchObjectException (or javax.ejb.NoSuchObjectLocalException if the client is local) would be thrown if a client would invoke a method on the EJBObject stub and the underlying object couldn't serve the purpose. In the case of a getEJBObject
on a Handle, I believe that java.rmi.RemoteException would be thrown by the container.

My 2 cents.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy! The NoSuchObjectException is normally what you'd get when you invoke a method on a *stub* object and the Remote object the stub was a proxy for is not available.

But Handles are not stubs... they're just Java objects that somehow know (it's up to the Container provider to implement the Handle class however it wants to) how to connect back to the server and retrieve a stub that is *functionally* identical to the original stub from which the Handle was retreived.

So, since the Handle is not a stub, you're not making a *traditional* RMI Remote method invocation on the Handle, even though the Handle is certainly going to be making a network call, so that's why the RemoteException makes sense... "Something went wrong with the Remote part of this method..."

Hope that helps. We should have explained that better.

cheers,
Kathy
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic