GREAT instructions are here http://jadclipse.sourceforge.net/wiki/index.php/Main_Page
.... more to come...
Since I am behind corporate proxy, Eclipse Marketplace is blocked (as usual....)... so I had to download the jar and put in in ECLIPSE_HOME\plugin folder... and restart Eclipse.
In Eclipse, check that JadClipse menu appears in Windows/Preferences/Java. Remember to set path to jad (you will have to download it separately).
Tuesday, September 15, 2015
Saturday, September 12, 2015
Java Mission Control, the Swiss Knife of Monitoring
I have extensively used JRockit Mission Control and really missed when I moved to Sun-JVM projects.... now that we use WebLogic 12 we have Java 1.7 (> u40) and so we can use Java Mission Control (JMC), which is exactly like the JRockit version..... with its fantastic Flight Recorder...
Awesome presentation here ( a bit blabla in the first few minutes.... just be patient...)
Here the code used in the example:
This video is much shorter and at the end it shows how to solve locking issues
Awesome presentation here ( a bit blabla in the first few minutes.... just be patient...)
Here the code used in the example:
package com.pierre;
public class DeadlockGenerator {
private static class AllocThread extends Thread {
public void run() {
while (true) {
Thread.yield();
try {
sleep(20 * 1000);
} catch (Exception e) {
}
for (int i = 0; i < 40000; i++) {
char[] tmp = new char[1024 * 1024];
tmp[1] = 'a';
}
}
}
}
private static class LockerThread extends Thread {
Object l1;
Object l2;
public void init(Object lock1, Object lock2) {
l1 = lock1;
l2 = lock2;
}
public void run() {
while (true) {
synchronized (l1) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
;
}
synchronized (l2) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
;
}
System.out.println("Got one!");
}
}
}
public static void main(String[] args) {
AllocThread allocThread = new AllocThread();
Object lock1 = new Object();
Object lock2 = new Object();
LockerThread first = new LockerThread();
LockerThread second = new LockerThread();
first.init(lock1, lock2);
second.init(lock2, lock1);
allocThread.start();
first.start();
second.start();
}
}
This video is much shorter and at the end it shows how to solve locking issues
Labels:
jmc
monitoring remotely with jvisualvm and jstatd
If you run jstatd on a machine, you will get:
So, create a jstatd.policy file and enter:
(full documentation of policy files here )
then run "jstatd -J-Djava.security.policy=jstatd.policy"
Now in jvisualvm you can add remote host, then right-click on the host, "add jstatd connection" and this will connect to the default 1099 port on remote host (it's a RMI server, so it uses the default RMI port)
use "jps" from your local machine to check that the jstatd is actually reachable.
See also http://www.nljug.org/nieuws/blog-profiling-remote-jvm-using-visualvm/ for a more complete list of options. Particularly useful the -p option and the -J-Djava.rmi.server.hostname=x.x.x.x .
could not create remote object
access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write")
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:783)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
So, create a jstatd.policy file and enter:
grant codebase "file:D:/pierre/Java/jdk1.7.0_79/lib/tools.jar" {
permission java.security.AllPermission;
};
(full documentation of policy files here )
then run "jstatd -J-Djava.security.policy=jstatd.policy"
Now in jvisualvm you can add remote host, then right-click on the host, "add jstatd connection" and this will connect to the default 1099 port on remote host (it's a RMI server, so it uses the default RMI port)
use "jps
See also http://www.nljug.org/nieuws/blog-profiling-remote-jvm-using-visualvm/ for a more complete list of options. Particularly useful the -p
Labels:
jstatd. jvisualvm
Subscribe to:
Posts (Atom)