db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Ancient history: question about some mysterious code in MessageService.java
Date Sat, 04 Jul 2015 18:55:43 GMT

I've been digging into o.a.d.iapi.services.i18n.MessageService.java.

Going all the way back to the original code import (revision 37083),
MessageService.getLocalizedMessage() contains this bit of code:

                 try {
                         msg[0] = formatMessage(getBundleForLocale(locale, messageId), messageId,
arguments, true);
                         rc[0] = 0;
                         return;
                 } catch (MissingResourceException mre) {
                         // message does not exist in the requested locale
                         // most likely it does exist in our fake base class _en, so try that.
                 } catch (ShutdownException se) {
                 }
                 msg[0] = formatMessage(getBundleForLocale(EN, messageId), messageId, arguments,
false);
                 rc[0] = 0;

I'm wondering specifically about the bit:

                 } catch (ShutdownException se) {
                 }

Why is this code here? Under what circumstances would we want to
discard the ShutdownException and continue processing like this?

Anybody have any memories of why this code was written this way?

I did spend some time reading DERBY-4920, DERBY-4911, and particularly
the epic DERBY-4741, all of which suggest that the presence of ShutdownException
handling in the code, in general, is due to the fact that when the engine
is being shutdown, there may be multiple threads which are active, and
the engine's shutdown logic uses JDK "interrupt" features to cause those
threads to receive ShutdownException exceptions being thrown.

But those old JIRAs, marvelous as they are, didn't really clarify why
MessageService has any business discarding the exception in this manner.

thanks,

bryan

Mime
View raw message