• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RMI Question another one ?

 
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aaaaaaarrghhhhhh
I'm trying to unbind my connection factory, so I can stop client accessing the Server while I re-cache the Database. Though I'm having problems, I receive the ExportError Exception: ObjID Already in use when I try to create the registry for the second time.
My code is as Follows

So is there anyway of un-creating the registry once it's created, without quiting the application ? Or have people just quit the application if they want rid of the RMI connection, which to me seems a bit rubbish.
Any help would be appreciated ?
Tony
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking through the Sun developers forum the only way to stop the RMI registry is to exit the main thread. Why I don't know ?
So restarting the Server progrmatically seems to be a little difficult and I would think not worth the hassle.
I wonder if all entrys in the registry are deleted when it is stoped via exit.
Tony
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tony,
In your case, I think all you need to do is unbind() your remote object from the registry. You can leave the registry running while you re-cache the database. Any client that then tries to get a reference to your remote object will fail. This should meet your requirements.
Alternatively: don't try to code for this at all . After all, there is no requirement to re-cache the database.
It has also been mentioned quite a few times in this forum that it does not appear to be programattically possible to shut down the registry.
I would guess that this is because of complexity / security reasons. You would presumably need the registry to listen on some other "administration" port for commands such as shutting down the registry. You would probably want to password protect it (so it cannot be shut down by a malicious user). You would probably want some command to just disable new registrations first, before removing existing registrations. You would probably want to have some way of notifying existing clients that their registrations is being removed. And so on.
I think the only thing you can do is just exit() your main application which will shut down the registry.
If you wanted to be nice you could check if anyone else has registered with your registry first, and display a warning message if that does happen. (But since most people don't set up the security necessary for other applications to register with their registry, I guess this can't happen anyway, so you might also wan't to skip it).
Regards, Andrew
reply
    Bookmark Topic Watch Topic
  • New Topic