test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.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 LFMultiThreadCachingTest
  26  * @bug 8046703
  27  * @summary Test verifies that lambda forms are cached when run with multiple threads
  28  * @author kshefov
  29  * @library /lib/testlibrary/jsr292 /lib/testlibrary
  30  * @build TestMethods
  31  * @build LambdaFormTestCase
  32  * @build LFCachingTestCase
  33  * @build LFMultiThreadCachingTest
  34  * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFMultiThreadCachingTest
  35  */
  36 
  37 import java.lang.invoke.MethodHandle;
  38 import java.util.EnumSet;
  39 import java.util.Map;
  40 import java.util.concurrent.BrokenBarrierException;
  41 import java.util.concurrent.ConcurrentLinkedQueue;
  42 import java.util.concurrent.CountDownLatch;
  43 import java.util.concurrent.CyclicBarrier;
  44 
  45 /**
  46  * Multiple threaded lambda forms caching test class.
  47  */
  48 public final class LFMultiThreadCachingTest extends LFCachingTestCase {
  49     private static final TestMethods.Kind[] KINDS;
  50     static {
  51         EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
  52         KINDS = set.toArray(new TestMethods.Kind[set.size()]);
  53         if (KINDS.length < 2) {
  54             throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");




  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 LFMultiThreadCachingTest
  26  * @bug 8046703
  27  * @summary Test verifies that lambda forms are cached when run with multiple threads
  28  * @author kshefov
  29  * @library /lib/testlibrary/jsr292 /lib/testlibrary
  30  * @build TestMethods
  31  * @build LambdaFormTestCase
  32  * @build LFCachingTestCase
  33  * @build LFMultiThreadCachingTest
  34  * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -XX:ReservedCodeCacheSize=64m LFMultiThreadCachingTest
  35  */
  36 
  37 import java.lang.invoke.MethodHandle;
  38 import java.util.EnumSet;
  39 import java.util.Map;
  40 import java.util.concurrent.BrokenBarrierException;
  41 import java.util.concurrent.ConcurrentLinkedQueue;
  42 import java.util.concurrent.CountDownLatch;
  43 import java.util.concurrent.CyclicBarrier;
  44 
  45 /**
  46  * Multiple threaded lambda forms caching test class.
  47  */
  48 public final class LFMultiThreadCachingTest extends LFCachingTestCase {
  49     private static final TestMethods.Kind[] KINDS;
  50     static {
  51         EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
  52         KINDS = set.toArray(new TestMethods.Kind[set.size()]);
  53         if (KINDS.length < 2) {
  54             throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");