Fix issues reported by Ingo on the dev mailing list where Jitsi fails to shutdown properly.

The fix relies on just calling System.exit() when we choose to shut down and the felix shutdown hooks take care of stopping everything nicely.
I've replaced the System.exit() call in the shutdown-timeout plugin with Runtime.getRuntime().halt() which doesn't run the shutdown hooks in felix so can't be blocked.

We'll need to keep a close eye on this to ensure that we're not resorting to the halt() in the shutdown-plugin in the mainline case. In future I hope to add a thread dump to the log just before we call .halt() to help diagnose problems in this area.
cusax-fix
Tom Denham 13 years ago
parent c288a70d3c
commit 502b281e12

@ -31,7 +31,6 @@
import net.java.sip.communicator.impl.gui.utils.Constants;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.ContactList;
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*;
@ -1201,15 +1200,9 @@ public void beginShutdown()
}
finally
{
try
{
GuiActivator.bundleContext.getBundle(0).stop();
}
catch (BundleException ex)
{
logger.error("Failed to being gentle shutdown of Felix.", ex);
System.exit(0);
}
// Just exit. The shutdown hook in felix ensures that we stop
// everything nicely.
System.exit(0);
}
}

@ -109,7 +109,7 @@ public void run()
+ shutDownTimeout + "ms.");
wait(shutDownTimeout);
logger.error("Failed to gently shutdown. Forcing exit.");
System.exit(SYSTEM_EXIT_CODE);
Runtime.getRuntime().halt(SYSTEM_EXIT_CODE);
}catch (InterruptedException ex){
if (logger.isDebugEnabled())
logger.debug("Interrupted shutdown timer.");

Loading…
Cancel
Save