This program sets up a grid of buttons and repeatedly sets the labels on them.
It runs perfectly on Windows 95; I have run it for days at a time.
On a much more powerful Solaris Ultra system it pauses, freezes, and appears to
hang, sometimes within as few as 5 seconds. (always within 60 secs).
Sometimes it recovers from the hang, usually not. It's awful that it works
on Windows but bombs on Solaris.
If you think a 9x9 grid of buttons is unreasonable (why?) you can see the
same behavior on smaller grids with "java d 5"
compile with javac d.java
run with java d
// test case for bug NNNNNNN - Peter van der Linden ###@###.###
import java.awt.*;
public class d extends Panel {
static Button l[][];
static int i=9, j=9; // size of grid, i is rows, j is cols
public static boolean changeLabels() {
for ( ;; )
for (int row=0; row < i; row++)
for (int m=0; m < j; m++)
l[row][m].setLabel( "A" );
}
public static void main(String args[]) {
if (args.length == 1) { // grid of a different size
i = j = Integer.parseInt(args[0].trim());
}
d f = new d();
f.setLayout( new GridLayout(i,j) );
f.setSize(400,400);
f.setVisible(true);
l = new Button[i][j];
for (i=0; i<l.length; i++) {
for (j=0; j<l[0].length; j++) {
f.add( l[i][j] = new Button("") );
l[i][j].setBackground(Color.white);
l[i][j].setForeground(Color.black);
}
}
Frame holder = new Frame(" ");
holder.setSize(410,410);
holder.setVisible(true);
holder.add(f);
holder.invalidate();
holder.validate();
f.changeLabels();
}
}
It runs perfectly on Windows 95; I have run it for days at a time.
On a much more powerful Solaris Ultra system it pauses, freezes, and appears to
hang, sometimes within as few as 5 seconds. (always within 60 secs).
Sometimes it recovers from the hang, usually not. It's awful that it works
on Windows but bombs on Solaris.
If you think a 9x9 grid of buttons is unreasonable (why?) you can see the
same behavior on smaller grids with "java d 5"
compile with javac d.java
run with java d
// test case for bug NNNNNNN - Peter van der Linden ###@###.###
import java.awt.*;
public class d extends Panel {
static Button l[][];
static int i=9, j=9; // size of grid, i is rows, j is cols
public static boolean changeLabels() {
for ( ;; )
for (int row=0; row < i; row++)
for (int m=0; m < j; m++)
l[row][m].setLabel( "A" );
}
public static void main(String args[]) {
if (args.length == 1) { // grid of a different size
i = j = Integer.parseInt(args[0].trim());
}
d f = new d();
f.setLayout( new GridLayout(i,j) );
f.setSize(400,400);
f.setVisible(true);
l = new Button[i][j];
for (i=0; i<l.length; i++) {
for (j=0; j<l[0].length; j++) {
f.add( l[i][j] = new Button("") );
l[i][j].setBackground(Color.white);
l[i][j].setForeground(Color.black);
}
}
Frame holder = new Frame(" ");
holder.setSize(410,410);
holder.setVisible(true);
holder.add(f);
holder.invalidate();
holder.validate();
f.changeLabels();
}
}
- duplicates
-
JDK-4081436 GC sometimes causes the ScreenUpdater thread to starve, i.e not get scheduled.
- Closed