Skip to content

Instantly share code, notes, and snippets.

Avatar

Clean Tutorials cleantutorials

View GitHub Profile
View ToDoMBean.java
package com.cleantutorials.jconsole.mbeans;
public interface ToDoMBean {
public void storeTask(String taskName);
public String dequeueTask();
public int getTasksLeft();
View ToDo.java
package com.cleantutorials.jconsole.mbeans;
import java.util.LinkedList;
import java.util.Queue;
public class ToDo implements ToDoMBean {
Queue<String> taskQueue = new LinkedList<String>();
@Override
View JConsole_MbeanExmple_Main.java
package com.cleantutorials.jconsole.mbeans;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
public class Main {
public static void main(String[] args) throws Exception {
View CPUUsage.java
package com.cleantutorials.jconsole.cpu;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;
/**
* A class to demonstrate the CPU usage in the system space and the user space
View stack-trace-threadstate-class.txt
Thread Name:TIMED_WAITING Example
Thread State:TIMED_WAITING
java.lang.Thread.sleep(Native Method)
com.cleantutorials.jconsole.thread.TimedWaitingThread.run(ThreadState.java:97)
Thread Name:Attach Listener
Thread State:RUNNABLE
View ThreadState.java
package com.cleantutorials.jconsole.thread;
import java.util.Set;
/**
* Creates multiple threads and starts them for demonstrating the state of the
* thread. If you plan to run the example, please manually kill the process as
* there is no graceful exit in the program.
*/
public class ThreadState {
View jconsole-start-jconsole-args-example.txt
jconsole -J-Djavax.net.ssl.keyStore="B:\JMX Client\Security\clientkeystore"
-J-Djavax.net.ssl.keyStorePassword=clientpass
-J-Djavax.net.ssl.trustStore="B:\JMX Client\Security\clienttruststore"
-J-Djavax.net.ssl.trustStorePassword=clienttrustpass
View jconsole-start-jconsole-args-template.txt
-J-Djavax.net.ssl.keyStore=<Client-KeyStore-Path>
-J-Djavax.net.ssl.keyStorePassword=<storepass of KeyStore(Client)>
-J-Djavax.net.ssl.trustStore=<Client-TrustStore-Path>
-J-Djavax.net.ssl.trustStorePassword=<storepass of TrustStore(Client)>
View jconsole-remote-access-args-example.txt
-Dcom.sun.management.jmxremote.password.file=B:\JMX\jmxremote.password
-Dcom.sun.management.jmxremote.access.file=B:\JMX\jmxremote.access
-Djava.rmi.server.hostname=192.168.1.4
-Dcom.sun.management.jmxremote.port=64355
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=true
-Dcom.sun.management.jmxremote.ssl.need.client.auth=true
-Dcom.sun.management.jmxremote.registry.ssl=true
-Djavax.net.ssl.keyStore="B:\JMX\Security\serverkeystore"
-Djavax.net.ssl.keyStorePassword=serverpass
View jconsole-remote-access-args-template.txt
-Dcom.sun.management.jmxremote.password.file=<Password-file>
-Dcom.sun.management.jmxremote.access.file=<Access-file>
-Djava.rmi.server.hostname=<host-ip>
-Dcom.sun.management.jmxremote.port=<rmi-port>
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=true
-Dcom.sun.management.jmxremote.ssl.need.client.auth=true
-Dcom.sun.management.jmxremote.registry.ssl=true
-Djavax.net.ssl.keyStore=<Server-KeyStore-Path>
-Djavax.net.ssl.keyStorePassword=<storepass of KeyStore(server)>