Hi everyone,
I have some questions concerning exceptions:
My MetaData Class is a singleton. I have two methods:
I have decided to implement two methods, thus I have a distinction between the instantiation of MetaData and the providing of its instance.
The second reason consists in the different exception handling for the MagicCookieException and IOException:
The createInstance will only be called within my ConnectionFactoryImpl or my getLocalConnection-method within my RoomConnector-Class. Thus I can avoid that my Remote Client has to handle the MagicCookieException or the IOException which may occur while reading the header information.
1. Does my argumentation sounds reasonable?
2. What do you think about throwing an unchecked FatalSystemException within the getInstance()-method?
Why throwing an unchecked exception? Because the client has first to call the createInstance()-method before being able to call getInstance(). So it's an implementation error. Sounds reasonnable?
3. Concerning the handling of the beforementioned MagicCookieException and IOException at the caller's side:
Within my Server GUI, I have decided to create for my 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?
4. For the local connection, the concerning exceptions will be wrapped within the more general GUIException with the concerning message.
An application exit wouldn't be necessary.
I would be very thankful about comments,
Greetings
Ulrich
[ January 19, 2004: Message edited by: Ulrich Heeger ]
[ January 19, 2004: Message edited by: Ulrich Heeger ]
[ January 19, 2004: Message edited by: Ulrich Heeger ]
[ January 19, 2004: Message edited by: Ulrich Heeger ]