Original credit to Sam Pullara: https://gist.github.com/612643
Records classes that are loaded. Then loads them first the next time. This can
dramatically decrease the initial hit on a first request to web service or other
cases where things are loaded lazily it would be nice to precache them. It only
loads the classes and does not run their static initializers. I try and skip
most generated classes from Java and Guice.
To create the agent jar:
jar cmf util/util-class-preloader/src/main/java/com/twitter/class-preloader/manifest \
preload.jar -C util/util-class-preloader/target/classes/ .
To use the agent jar:
java -javaagent:/path/to/preload.jar=/tmp/classes.txt Main
You can use this agent in combination with other agents. Just make sure that the other agents are
first on the command line otherwise preload.jar will load all the classes before they get a chance
to add their hook.