• 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

Can remote object be automatically unexported?

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

I have a factory that produces remote objects (lets call it RO), I keep a Set of these ROs in the factory so when I stop the server I am able to unexport them all.

RO implements Unreferenced interface so when it crashes or simply exits its unreferenced() method will let know the factory that it can unexport this object and remove it from the Set.

The UnicastRemoteObject.unexportObject method throws NoSuchObjectException, and my question is, is there any possibility (other than the remote object is unreferenced) that object can be removed from table by rmi or any other reason? Object should be unexported when rmi finds out that the remote object is no longer referenced, what about if client would connect and do nothing for 3 days or something? Is this situation possible? Now everything works fine, but I'm not sure how should I handle that exception, because I'm not sure what can cause the object to be removed from the table. I wonder if I should close the server entirely if this happens.

Any comments would be really appreciated.
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're asking a general question so you'll probably get many different responses. Here's mine.

I don't use unreferenced(). My server(s) are available whenever a client needs them. It's none of my business if a client doesn't call for three days. If I need to save resources on a low volume server, then I use the Activatable RMI.

It's nice to unexport a server when it exits. But I don't get excited about not doing it. I always use rebind, never bind. That takes care of the crash problem. If unexport throws a not-found, I just ignore it.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic