Hi everyone,
I'm having a particularly perplexing problem. I have an application that uses a custom subclass of a JTree to hold some data. I want this data to persist after the user closes the application, so my idea was to have the application serialize the Tree when it exits, and deserialize it when it starts again.
Initially I accomplished this using the "windowClosing()" method, and it worked fine, but then I realized that on some platforms (Mac OS X, for instance), the "WindowClosing()" event is not necessarily fired when the user quits the application.
So, I switched to having the serialization done in a shutdown hook
thread. Now, whenever the application shuts down, it reaches the point where it starts the serialization, but then simply hangs!
Does this sound like a deadlock problem, or does anyone else have any ideas on what might be causing the hang? Two things that might be of note:
1. I started
testing to make sure that my Tree isn't null before I try to serialize it (my theory being that maybe the object was being disposed before I tried to serialize it)--and it isn't.
2. If I try to serialize a new instance of the Tree class rather than my existing one, everything works fine--the class serializes and the application exits normally.
Any ideas, or do you think I'm even in the right forum?
Thanks in advance,
Buzz Andersen