ThreadStateTest.java revision 1153
3867N/Apublic class ThreadStateTest {
3867N/A private static boolean testFailed = false;
4254N/A synchronized (globalLock) {
3867N/A } catch (InterruptedException e) {
3867N/A e.printStackTrace();
3867N/A testFailed = true;
3867N/A if (testFailed)
3867N/A private static void checkLockInfo(Thread t, Thread.State state, Object lock, Thread owner) {
} catch (InterruptedException e) {
e.printStackTrace();
testFailed = true;
super(name);
private boolean done = false;
public void run() {
while (!done) {
switch (state) {
case RUNNABLE: {
sum += x - r;
case BLOCKED: {
synchronized (globalLock) {
case WAITING: {
synchronized (globalLock) {
} catch (InterruptedException e) {
case TIMED_WAITING: {
synchronized (globalLock) {
} catch (InterruptedException e) {
case PARKED: {
case TIMED_PARKED: {
case SLEEPING: {
} catch (InterruptedException e) {
interrupted();
case TERMINATE: {
done = true;
public void waitUntilStarted() {
public void goBlocked() {
public void goWaiting() {
public void goTimedWaiting() {
public void goParked() {
public void goTimedParked() {
public void goSleeping() {
public void terminate() {
switch (state) {
case BLOCKED:
case WAITING:
case TIMED_WAITING:
synchronized (globalLock) {
case PARKED:
case TIMED_PARKED:
case SLEEPING:
this.interrupt();