I have a problem after JRE update.
If I have a launched Java application and initiate system restart – Windows fails to automatically stop this Java application and I get following message:
“This program is preventing Windows from restarting”.
If I press cancel, then I could see that Java application that prevents restart hangs.
This issue affects both my Java applications and such applications as jconsole.
Before JRE update everything works fine on JRE 1.6.0_26.
I first faced this problem on JRE 1.6.0_36. But it also happens on 1.6.0_39.
P.S: I have Windows Server 2008 R2 Interprise
Have anyone had same problem or can suggest what to do in this situation?
Thanks.
Update:
I have implemented following addhook:
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
logger.log("SHUTDOWN - BEGIN");
((Window) view).setVisible(false);
logger.log("SHUTDOWN - Visible");
((Window) view).dispose();
logger.log("SHUTDOWN - Dispose");
System.exit(0);
}
});
After that applications with such addhook closes normally on system restart, but I figured out that if we just close application (by pressing exit or “x”) Java VM not terminated (we can see javaw process in taskmgr).
From log file I could see that program never leaves dispose() function. In case if I comment dispose() and leave only System.exit(0) Java VM still not able to terminate.
Update 2:
Ticket has been created for this issue. And we received following reply from Oracle: “Problem reproduced and confirmed.”
This issue fixed by Oracle. Fix will be included in the upcoming version of JRE (1.6.0_42?).
As a workaround for your application you can use addhook. Something like this:
You should use Runtime.halt(0) instead of System.exit(0), because Java Machine refuses to stop after System.exit(0) in current version of JRE.