1/*
2 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25package sun.jvm.hotspot.runtime;
26
27/** This is a type-safe enum mirroring the JavaThreadState enum in
28    globalDefinitions.hpp. The conversion between the underlying ints
29    and these values is done in JavaThread. */
30
31public class JavaThreadState {
32  private String stringVal;
33
34  /** Should never happen (missing initialization) */
35  public static final JavaThreadState UNINITIALIZED     = new JavaThreadState("UNINITIALIZED");
36  /** Just starting up, i.e., in process of being initialized */
37  public static final JavaThreadState NEW               = new JavaThreadState("NEW");
38  /** Corresponding transition state (not used, included for completness) */
39  public static final JavaThreadState NEW_TRANS         = new JavaThreadState("NEW_TRANS");
40  /** Running in native code */
41  public static final JavaThreadState IN_NATIVE         = new JavaThreadState("IN_NATIVE");
42  /** Corresponding transition state */
43  public static final JavaThreadState IN_NATIVE_TRANS   = new JavaThreadState("IN_NATIVE_TRANS");
44  /** Running in VM */
45  public static final JavaThreadState IN_VM             = new JavaThreadState("IN_VM");
46  /** Corresponding transition state */
47  public static final JavaThreadState IN_VM_TRANS       = new JavaThreadState("IN_VM_TRANS");
48  /** Running in Java or in stub code */
49  public static final JavaThreadState IN_JAVA           = new JavaThreadState("IN_JAVA");
50  /** Corresponding transition state (not used, included for completness) */
51  public static final JavaThreadState IN_JAVA_TRANS     = new JavaThreadState("IN_JAVA_TRANS");
52  /** Blocked in vm */
53  public static final JavaThreadState BLOCKED           = new JavaThreadState("BLOCKED");
54  /** Corresponding transition state   */
55  public static final JavaThreadState BLOCKED_TRANS     = new JavaThreadState("BLOCKED_TRANS");
56  /** Special state needed, since we cannot suspend a thread when it is in native_trans */
57
58  private JavaThreadState(String stringVal) {
59    this.stringVal = stringVal;
60  }
61
62  public String toString() {
63    return stringVal;
64  }
65}
66