concept JRebel in category osgi

appears as: JRebel
OSGi in Action: Creating Modular Applications in Java

This is an excerpt from Manning's book OSGi in Action: Creating Modular Applications in Java.

Hotswap With JRebel

Yes, you can do better. A JVM agent called JRebel (formerly known as JavaRebel; www.zeroturnaround.com/jrebel/) behaves in a way similar to HotSwap but has much better support for custom class-loading solutions like OSGi. For those who don’t know, a JVM agent is a small native library that attaches to the process on startup and is granted low-level access to the Java runtime. Whenever you recompile a class, JRebel automatically updates the appropriate version loaded in the JVM without affecting any other versions of the class. This makes it easy to develop, debug, and compare different releases of an application at the same time.

What are the downsides? The main downside is reduced performance due to the extra tracking involved. JRebel also needs to know how custom class loaders map their classes and resources to local files. It currently supports the Equinox OSGi implementation, but there’s no guarantee it will work with other OSGi frameworks. Finally, you need to add an option to the JVM command line to use it, which is problematic in production environments that lock down the JVM’s configuration. Some places won’t let you use JVM agents at all because of the potential security issues involved. Agents have access to the entire process and can redefine almost any class in your application. Adding an agent to your JVM is like giving root access to a user in Linux. For these reasons, JRebel is usually best suited to development environments.