test/gc/metaspace/G1AddMetaspaceDependency.java

Print this page




   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 /*
  25  * @test G1AddMetaspaceDependency
  26  * @bug 8010196

  27  * @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor
  28  * @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency
  29  */
  30 
  31 import java.io.InputStream;
  32 
  33 public class G1AddMetaspaceDependency {
  34 
  35   static byte[] getClassBytes(String name) {
  36     byte[] b = null;
  37     try (InputStream is = ClassLoader.getSystemResourceAsStream(name)) {
  38       byte[] tmp = new byte[is.available()];
  39       is.read(tmp);
  40       b = tmp;
  41     } finally {
  42       if (b == null) {
  43         throw new RuntimeException("Unable to load class file");
  44       }
  45       return b;
  46     }




   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 /*
  25  * @test G1AddMetaspaceDependency
  26  * @bug 8010196
  27  * @requires vm.gc=="G1" | vm.gc=="null"
  28  * @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor
  29  * @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency
  30  */
  31 
  32 import java.io.InputStream;
  33 
  34 public class G1AddMetaspaceDependency {
  35 
  36   static byte[] getClassBytes(String name) {
  37     byte[] b = null;
  38     try (InputStream is = ClassLoader.getSystemResourceAsStream(name)) {
  39       byte[] tmp = new byte[is.available()];
  40       is.read(tmp);
  41       b = tmp;
  42     } finally {
  43       if (b == null) {
  44         throw new RuntimeException("Unable to load class file");
  45       }
  46       return b;
  47     }