Version 1

    Currently there are a number of techniques that are used for hot deployment in java.

     

    Application Server Hot Deployment

     

    Discarding the ClassLoader and then re-loading all application classes works quite well for small projects, however for large applications it is often not as effective. For bigger projects the time spent initializing the application is often much greater than the amount of time the application server takes to load, so the time saving is quite small. Discarding the old application can also result in significant garbage collection overhead, so in some cases a hot deployment can actually be slower than an application server restart.

     

    Hotswap

    (This is built into the JVM)

    hotswap allows you to change the bytecode of a loaded class. It does not allow any schema modifications, and it will fail if the class schema has changed in any way. Although this can be a time saver for correcting minor bugs, it is certainly not a complete solution.

     

    Web framework ClassLoader based hot deployment

    (This is the type used by Seam 2, Tapestry etc)

    This is similar to application server hot deployment, in that it works by discarding the classloader of the application classes and re-loading them. It does not integrate will with services such as EJB's and JPA because there is no app server integration. It is however often faster than application server hot deployment for precisely this reason, and because it is often only applied to a subset of the applications classes.

     

    JRebel http://www.zeroturnaround.com

    (This information comes from their website, I have never actually used it)

    JRebel allows you to instantly reload classes, and allows most schema changes except for changing the super class and implemented interfaces. They also provide integrations for many common frameworks that reload the frameworks configuration when a class has been changed. It is not open source.

     

    Weblogic Fastswap http://download.oracle.com/docs/cd/E15051_01/wls/docs103/deployment/deployunits.html#wp1053872

    (This information comes from their website, I have never actually used it)

    Supports a smaller feature set than JRebel, the biggest difference is that it lacks reflection support. This severely limits its usefulness with regard to integrating with 3rd party frameworks, as many of them rely on annotation based metadata. This is not open source. 

     

    Fakereplace http://code.google.com/p/fakereplace/

    (This is my project, it is still a work in progress)

    Fakereplace works by transforming classes as they are loaded to make them hot deployable. It also instruments the reflection API so that these changes are visible via reflection. It currently has a similar feature set to Fastswap, except that it does not yet support changing method/field modifiers, (but it does support reflection, so it can integrate with frameworks). It currently integrates with Seam 2 and JSF. Fakereplace is licensed under the LGPL.

     

    Other resources

     

    My Blog post introducing Fakereplace

     

    Forum post about fakereplace