The modern openjdk’s JVM is able to print assembly for generated machine code – see Oracle’s blog post. To start working with this option you need hsdis plugin, available here. Then put the downloaded library to the location your OS aware of. E.g. if you’re using linux all you need is to update LD_LIBRARY_PATH: export [...]
Posts tagged java
Tuning Intellij Idea
First of all consider changing idea.vmoptions. idea.vmoptions is a text file with a list of JVM settings, it’s usually found in the bin folder in the Idea installation folder. This file can be open in any text editor. The following settings increase performance drastically on Sun JVM 1.6: -server -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m -XX:+UseConcMarkSweepGC -XX:+AggressiveOpts [...]
instanceof vs Visitor
I always was curious on how effective is visitor pattern vs instanceof when it comes to detect whether the given base implements certain interface or not. I had 7 interface classes and visitor for all of these, and 7 concrete implementations, then I tested instanceof and visitor pattern on a large collection of randomly picked [...]
Create self-sufficient JAR with maven
After getting stuck several times with maven assembly plugin I decided to make a note on how to create self-sufficient jar with maven. Self-sufficiency implies jar to include all the required dependencies so it can be started with java without specifying extra classpaths. <build> <plugins> <!– Packaging configuration –> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> [...]
context:annotation-config for StaticApplicationContext
For some reason I’m unable to use XML configuration for spring in the current project (and thus ClassPathXmlApplicationContext) – don’t ask me why So I’ve to specify the entire configuration in code (by using StaticApplicationContext.registerSingleton). The question is – how to make StaticApplicationContext work as if “annotation-config” is specified to make application context process annotated [...]
How to write and debug your own annotations processor.
This is a short but comprehensive guide on how to write and debug your own annotations processor (assuming you are using Java 6, should work on Java 7 as well). Create jar where your annotations processor will reside, say ann-proc.jar (Just define annotation processor class).You may want to add dependency to the JDK’s tools.jar in [...]
Posts