Tuesday, 7 August 2018

jcmd: Display status of commercial features

‘VM.check_commercial_features’ is used to get the status of commercial features.

For example,
HelloWorld.java
public class HelloWorld {
 public static void main(String args[]) throws Exception {
  Thread t1 = new Thread() {
   public void run() {
    while (true) {
     try {
      Thread.sleep(5000);
     } catch (Exception e) {

     }
    }
   }
  };

  t1.start();
 }
}

Compile and run HelloWorld.java.

Launch HelloWorld application using -XX:+UnlockCommercialFeatures.

java -XX:+UnlockCommercialFeatures -classpath . HelloWorld

Open new command prompt and execute jcmd command.

C:\>jcmd
4544 org.apache.chemistry.opencmis.workbench.Workbench
12132 sun.tools.jcmd.JCmd
72 HelloWorld

As you see ‘HelloWorld’ application is running with process id 72. Now execute the command ‘jcmd 72 VM.check_commercial_features’.

C:/>jcmd 72 VM.check_commercial_features
72:
Commercial Features are unlocked.
Status of individual features:
  Java Flight Recorder has not been used.
  Resource Management is disabled.
  Current Memory Restriction: None (0)


Previous                                                 Next                                                 Home

No comments:

Post a Comment