Skip to content

Instantly share code, notes, and snippets.

@tgrabiec
Created May 18, 2010 20:15
Show Gist options
  • Save tgrabiec/405478 to your computer and use it in GitHub Desktop.
Save tgrabiec/405478 to your computer and use it in GitHub Desktop.
class Test {
static enum E {
E1, E2, E3, E4, E5;
}
public static void main(String []args) {
Thread threads[] = new Thread[30];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread() {
public void run() {
for (int i = 0; i < 10000; i++);
E e = E.E1;
if (e == null)
throw new AssertionError();
}
};
}
for (int i = 0; i < threads.length; i++)
threads[i].start();
}
}
------------------------------------------
while true; do ./jato Test; done
Exception in thread "Thread-17" java.lang.AssertionError
at Test$1.run(Test.java:15)
at java.lang.VMThread.run(VMThread.java:120)
Exception in thread "Thread-16" java.lang.AssertionError
at Test$1.run(Test.java:15)
at java.lang.VMThread.run(VMThread.java:120)
Exception in thread "Thread-16" java.lang.AssertionError
at Test$1.run(Test.java:15)
at java.lang.VMThread.run(VMThread.java:120)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment