Re: Static initilizer failed to execute?



"Virgil Green" <vjg@xxxxxxxxxxxxxxxxxx> wrote in message
news:zMtce.4192$461.1124@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> We had what I consider to be an extremely odd occurrence this morning. A
> class that has not been changed for over 2 years appears to have failed to
> run its static initializer code.
>
> Because the code in question accesses another system, I track execution
> times via logging messages. This class is loaded every morning. I've noted
> that I have the messages logged showing that the static initializer code
> *has* executed every morning for as far back as I have logs, back to March
> 18, 2005.
>
> For some very odd reason, the code seems not to have executed this
morning.
> When I shut down the JVM and restarted it, the code executed as expected.
>
> So, my question is whether anyone has encountered a situation in which a
> static initializer simply failed to execute when there was no known
> modifications to code or environment?
>
> I'm completely befuddled by this one. Technically, the only evidence I
have
> is that no log entries were made, but I have no more reason to doubt the
> logging mechanism that I do the static initializer code itself.
>
> Here is the static initializer code. I haven't provided a complete,
working
> example because this is not a reproducible problem - it seems to be a
> complete anomaly:
>
> static
> {
> try
> {
> TimingReporter resolveDuration = new TimingReporter("Resolve to file
"
> + FILE_NAME);
> library =
> LibraryListManager.getInstance().resolveLibraryName(FILE_NAME,
> OBJECT_TYPE).trim();
> resolveDuration.report();
> } catch (Exception e)
> {
> e.printStackTrace();
> }
> }
>
> I would expect one of two things to happen:
>
> 1) the library variable would be populated and the
resolveDuration.report()
> call would produce a log entry telling me how long the operation took to
> complete.
> 2) there was an error (exception) in the resolveLibraryName() method and I
> would get a stacktrace printed.
>
> Neither of those happened, so I'm also investigating whether there was
some
> odd occurence within resolveLibraryName. However, since I only see two
paths
> through this static initializer and since both of those paths should have
> produced some observable output (either a log message or a printed
> stacktrace), I question whether the static initializer ran at all.
>
> All thoughts appreciated.

Never mind. I finally found the stacktrace printout. Indeed, the process
went through my option 2 described above.

--
Virgil


.