• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:exceptions while the registering and binding -process

 
Ulrich Heeger
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I'm reffering to this thread, where one question remained open:
1. Concerning the handling of the MagicCookieException and IOException which may occur while accessing the db-file and reading the header-informations (while calling the getMetaData()-method):
Within my Server GUI, I have decided to create for the RoomServer Class a new exception, called StartServerException.Within the startServer-method I have following exception handling:

My Server GUI will catch the StartServerException and will display the message to the user and alert him that the server will shut down:

Andrew wrote in another thread:

You cannot stop the Sun RMI Registry programattically.
You can stop (or unbind) your server process from the registry, and then bind a new server process to the registry

That's why I decided to shut down my server if an excpetion occured during the registering and binding-process, otherwise it could be quite complicate to recovery from this exception.
What do you think about that? How have you handled this or a similar problem?
Thanks in advance
Ulrich
 
Terry Martinson
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulrich -
In the case of an IllegalFileFormat, I force shut down of the server with appropriate alert box to user and corresponding console log message. It seemed to get complex if I attempted to try again after that error occurred (i.e. even if I let them change the file name in the server GUI, I think I still had problems).
However, in the case of invalid port or port already in use, it worked fine if I just allowed the server GUI user to change the port number and try again.
TJ
 
Ulrich Heeger
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Terry,
Thanks for your reply

In the case of an IllegalFileFormat, I force shut down of the server with appropriate alert box to user and corresponding console log message. It seemed to get complex if I attempted to try again after that error occurred (i.e. even if I let them change the file name in the server GUI, I think I still had problems).
However, in the case of invalid port or port already in use, it worked fine if I just allowed the server GUI user to change the port number and try again.

Before the registering- and binding process I make a validation of the portnumber, checking if the portnumber is a digit between 1024 and 65535.
If not, an IllegalArgumentException is thrown which won't be wrapped in a StartServerException. Thus, the Server GUI handles this exception differently and doesn't exit.
But I have omitted my messages within the StartServerException, I mean I will only throw new StartServerException(remoteEx). Thus, the association between exception and invalid portnumber isn't obviously anymore.
My handling at the caller's side now looks like:

Regards,
Ulrich
[ January 20, 2004: Message edited by: Ulrich Heeger ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic