in src/main/java/org/apache/log4j/chainsaw/LogUI.java [1340:1402]
public boolean shutdown() {
boolean confirmExit = sm.getGlobalConfiguration().getBoolean("confirmExit", true);
if (confirmExit) {
if (
JOptionPane.showConfirmDialog(
LogUI.this, "Are you sure you want to exit Chainsaw?",
"Confirm Exit", JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE) != JOptionPane.YES_OPTION) {
return false;
}
}
final JWindow progressWindow = new JWindow();
final ProgressPanel panel = new ProgressPanel(1, 3, "Shutting down");
progressWindow.getContentPane().add(panel);
progressWindow.pack();
Point p = new Point(getLocation());
p.move((int) getSize().getWidth() >> 1, (int) getSize().getHeight() >> 1);
progressWindow.setLocation(p);
progressWindow.setVisible(true);
Runnable runnable =
() -> {
try {
int progress = 1;
final int delay = 25;
panel.setProgress(progress++);
Thread.sleep(delay);
for( ChainsawReceiver rx : m_receivers ){
rx.shutdown();
}
panel.setProgress(progress++);
Thread.sleep(delay);
panel.setProgress(progress++);
Thread.sleep(delay);
} catch (Exception e) {
e.printStackTrace();
}
fireShutdownEvent();
performShutdownAction();
progressWindow.setVisible(false);
};
if (OSXIntegration.IS_OSX) {
/**
* or OSX we do it in the current thread because otherwise returning
* will exit the process before it's had a chance to save things
*
*/
runnable.run();
} else {
new Thread(runnable).start();
}
return true;
}