-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional service pack 2
A DESCRIPTION OF THE PROBLEM :
System hangs when trying to change tooltip or image for TrayIcon in shutdown hook.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile class I submitted, run it and press Ctrl+C or just close the console window to initiate shutdown hook method
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Two strings should apear on console and program should exit:
Setting tooltip
Tooltip set successfully
Or just first string and exception about not available tray icon
ACTUAL -
Tray icon disappears just after shutdown started, before first string "Setting tooltip" appears. After that system hangs and can be only terminated from Task Manager or "End Program" dialog
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There is not any error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
public class TestTray implements Runnable {
private static TrayIcon trayIcon;
public static void main(String[] args) throws Exception {
SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().createImage("trayicon.gif"));
tray.add(trayIcon);
Thread hookThread = new Thread(new TestTray());
Runtime.getRuntime().addShutdownHook(hookThread);
for (;;) {
Thread.sleep(1000);
}
}
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
System.out.println("Setting tooltip");
trayIcon.setToolTip("Stopping"); //hangs here, same with setImage method
System.out.println("Tooltip set successfully");
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
}
}
}
---------- END SOURCE ----------
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional service pack 2
A DESCRIPTION OF THE PROBLEM :
System hangs when trying to change tooltip or image for TrayIcon in shutdown hook.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile class I submitted, run it and press Ctrl+C or just close the console window to initiate shutdown hook method
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Two strings should apear on console and program should exit:
Setting tooltip
Tooltip set successfully
Or just first string and exception about not available tray icon
ACTUAL -
Tray icon disappears just after shutdown started, before first string "Setting tooltip" appears. After that system hangs and can be only terminated from Task Manager or "End Program" dialog
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There is not any error messages
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
public class TestTray implements Runnable {
private static TrayIcon trayIcon;
public static void main(String[] args) throws Exception {
SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().createImage("trayicon.gif"));
tray.add(trayIcon);
Thread hookThread = new Thread(new TestTray());
Runtime.getRuntime().addShutdownHook(hookThread);
for (;;) {
Thread.sleep(1000);
}
}
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
System.out.println("Setting tooltip");
trayIcon.setToolTip("Stopping"); //hangs here, same with setImage method
System.out.println("Tooltip set successfully");
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
}
}
}
---------- END SOURCE ----------
- relates to
-
JDK-6301682 EventQueue should prevent usage during shutdown hook
- Closed