The latest expert opinions, articles, and guides for the Java professional.
JRebel reloads changes to Java classes on-the-fly without redeploy or restart including new methods and fields. It is a generic solution that works for standalone Java applications as well as application servers. For the impatient: watch the demonstration screencast (~5 mins) and download!
Ever since HotSwap support has been introduced in Java 1.4 people have been craving for more. As witnessed by this bug in the Sun database and numerous other discussions changing method bodies was just not enough. Dynamic languages like Ruby were quick enough to capitalize on this lacking touting Java EE development as slow and cumbersome.
As time passed by people have tried to work around the limitation by reloading classes along with their classloader. However since this requires also to reconstruct the object state it will only work in a controlled and limited environment — e.g. that of a web framework like RIFE, Tapestry 5 and so on.
Just as many others we were working on a workaround. However instead of limiting ourselves to the facilities provided by the Java platform we devised a whole new approach. Using bytecode modification and a little bit of magic JRebel extends the JVM with ability to reload almost arbitrary changes to classes on-the-fly. This includes adding and removing both methods and fields and the only forbidden changes are to ‘extends’ and ‘implements’ clauses. Since all the existing object instances are preserved the application and server can continue running and code changes are immediately visible in the application.
Leave a comment