< prev index next >

test/serviceability/tmtools/jstack/TraveledLockTest.java

Print this page




  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 /*
  25  * @test
  26  * @summary Create a thread which stops in methods a(), a()->b(), a()->b()->c(),
  27  *          synchronizing on one monitor inside of each method.
  28  *          After checking that lock info is correct free the lock and
  29  *          invoke another method. Repeat this action.
  30  * @modules java.base/jdk.internal.misc
  31  * @library /test/lib/share/classes
  32  * @library ../share
  33  * @build common.*
  34  *
  35  * @run main/othervm -XX:+UsePerfData TraveledLockTest
  36  */
  37 import common.ToolResults;
  38 import java.util.Iterator;
  39 import utils.*;
  40 
  41 class TraveledLockDebuggee extends Thread {
  42 
  43     static final String THREAD_NAME = "MyThread";
  44 
  45     TraveledLockDebuggee() {
  46         setName(THREAD_NAME);
  47     }
  48 
  49     Object monitor = new Object();
  50 
  51     public void c() {
  52         synchronized (monitor) {
  53             Utils.sleep();
  54         }




  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 /*
  25  * @test
  26  * @summary Create a thread which stops in methods a(), a()->b(), a()->b()->c(),
  27  *          synchronizing on one monitor inside of each method.
  28  *          After checking that lock info is correct free the lock and
  29  *          invoke another method. Repeat this action.
  30  * @modules java.base/jdk.internal.misc
  31  * @library /test/lib
  32  * @library ../share


  33  * @run main/othervm -XX:+UsePerfData TraveledLockTest
  34  */
  35 import common.ToolResults;
  36 import java.util.Iterator;
  37 import utils.*;
  38 
  39 class TraveledLockDebuggee extends Thread {
  40 
  41     static final String THREAD_NAME = "MyThread";
  42 
  43     TraveledLockDebuggee() {
  44         setName(THREAD_NAME);
  45     }
  46 
  47     Object monitor = new Object();
  48 
  49     public void c() {
  50         synchronized (monitor) {
  51             Utils.sleep();
  52         }


< prev index next >