1 /* |
1 /* |
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
33 public class NMTWithCDS { |
33 public class NMTWithCDS { |
34 |
34 |
35 public static void main(String[] args) throws Exception { |
35 public static void main(String[] args) throws Exception { |
36 ProcessBuilder pb; |
36 ProcessBuilder pb; |
37 pb = ProcessTools.createJavaProcessBuilder( |
37 pb = ProcessTools.createJavaProcessBuilder( |
38 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump"); |
38 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump"); |
39 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
39 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
40 try { |
40 try { |
41 output.shouldContain("Loading classes to share"); |
41 output.shouldContain("Loading classes to share"); |
42 output.shouldHaveExitValue(0); |
42 output.shouldHaveExitValue(0); |
43 |
43 |
44 pb = ProcessTools.createJavaProcessBuilder( |
44 pb = ProcessTools.createJavaProcessBuilder( |
45 "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version"); |
45 "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:on", "-version"); |
46 output = new OutputAnalyzer(pb.start()); |
46 output = new OutputAnalyzer(pb.start()); |
47 output.shouldContain("sharing"); |
47 output.shouldContain("sharing"); |
48 output.shouldHaveExitValue(0); |
48 output.shouldHaveExitValue(0); |
49 |
49 |
50 } catch (RuntimeException e) { |
50 } catch (RuntimeException e) { |