< prev index next >

test/hotspot/jtreg/runtime/RedefineTests/RedefineRunningMethods.java

Print this page




  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  * @bug 8055008 8197901 8010319
  27  * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop
  28  * @library /test/lib
  29  * @modules java.base/jdk.internal.misc
  30  * @modules java.compiler
  31  *          java.instrument
  32  *          jdk.jartool/sun.tools.jar
  33  * @run main RedefineClassHelper
  34  * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace,all=trace:file=all.log RedefineRunningMethods
  35  */
  36 // Test is executed with full trace logging redirected to a file to ensure there is no crash during logging anonymous classes - see JDK-8197901
  37 
  38 
  39 // package access top-level class to avoid problem with RedefineClassHelper
  40 // and nested types.
  41 class RedefineRunningMethods_B {
  42     static int count1 = 0;
  43     static int count2 = 0;
  44     public static volatile boolean stop = false;
  45     static void localSleep() {
  46         try{
  47             Thread.currentThread().sleep(10);//sleep for 10 ms
  48         } catch(InterruptedException ie) {
  49         }
  50     }
  51 
  52     public static void infinite() {
  53         while (!stop) { count1++; localSleep(); }
  54     }




  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  * @bug 8055008 8197901 8010319
  27  * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop
  28  * @library /test/lib
  29  * @modules java.base/jdk.internal.misc
  30  * @modules java.compiler
  31  *          java.instrument
  32  *          jdk.jartool/sun.tools.jar
  33  * @run main RedefineClassHelper
  34  * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace,class+loader+data=debug,safepoint+cleanup,gc+phases=debug RedefineRunningMethods
  35  */
  36 // Test is executed with full trace logging redirected to a file to ensure there is no crash during logging anonymous classes - see JDK-8197901
  37 
  38 
  39 // package access top-level class to avoid problem with RedefineClassHelper
  40 // and nested types.
  41 class RedefineRunningMethods_B {
  42     static int count1 = 0;
  43     static int count2 = 0;
  44     public static volatile boolean stop = false;
  45     static void localSleep() {
  46         try{
  47             Thread.currentThread().sleep(10);//sleep for 10 ms
  48         } catch(InterruptedException ie) {
  49         }
  50     }
  51 
  52     public static void infinite() {
  53         while (!stop) { count1++; localSleep(); }
  54     }


< prev index next >