• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to close rmi server?

 
ZhiYuan Lin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all:

i have a question about how to close the rmi server?
i start the rmi server in code:
LocateRegistry.createRegistry(port);

System.out.println("Construction database server " +
"implementations ......");
String filename = System.getProperty("user.dir") + "/" + database;
RemoteData remoteData = new RemoteData(filename);
System.out.println("Binding database server implemntations " +
"to rmiregistry......");
Naming.rebind(REMOTEDATA_NAME, remoteData);
System.out.println("Waiting for invocation from clients......");

??? how to close it
thanks
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ZhiYuan
It appears that there is no clean way to do this. System.exit() may be the only option.
I did a check of whether anything was registered with the registry before shutting down (unlikely that there would be any other apps, but who's to say that our application is the only one that registers).
Regards, Andrew
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two solutions. 1 isn't in the requirements and can only have you lost points. But you can have a server GUI that the server manager can click a button that will shutdown the server. I chose this route and liked it.
The other chose is that the server manager will just use CTRL-C to close the server. This is fine to assume too.
Mark
 
ZhiYuan Lin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thinks
i choose to use CTRL-C to close the server.
it more simple and not need to change my codes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic