Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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
reply
    Bookmark Topic Watch Topic
  • New Topic