Skip to main content

Posts

Showing posts from June, 2015

Verbose class loading

At work, a couple of long time experience Java devs were having build issues. They didn't know where their build system was pulling in a class from. They didn't know that the JVM has a verbose class loading option. If you run java -h, you will see this in the output:     -verbose:[class|gc|jni]                  enable verbose output If you invoke your JVM like this: java -verbose:class myHelloWorld then the output will be very verbose as the class loader prints out detailed of all the classes loaded during startup and during the finding and running of your class. e.g. [Loaded java.net.URLConnection from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar] [Loaded sun.net.www.URLConnection from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar] [Loaded sun.net.www.protocol.file.FileURLConnection from /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar] [Loaded sun.net.www.MessageHeader from /usr/lib/jvm/j...

The OpenJDK9 Revised Java Memory Model

It can be helpful to consider the Java Memory Model when thinking about multithreading. It is being refreshed for Java 9: The OpenJDK Revised Java Memory Model JSR 133 https://jcp.org/en/jsr/detail?id=133 JSR 133 Cookbook Wikipedia: Java memory model