0 Replies Latest reply on Jul 3, 2010 5:06 PM by dan.j.allen

    A fresh perspective on hot deployment of Java classes

    dan.j.allen

      pmuir gave the following response the question raised during the JBoss Community Asylum podcast recorded live at JUDCon about including a hot swap library in Seam 3 or JBoss AS:

      This is something that we offered in Seam 2. The ability to do this was done in a fairly hacky way. What we did was allow you to put classes in a classloader that we would then monitor. If there were updates to the files on the filesystem, we would then discard that entire classloader and reload the classes from the disk.

       

      We could do this because we are component framework that manages the lifecycle of the other frameworks. We manage all entry points into the system. So therefore, we're able to use this special classloader.

       

      This is not a technique you could use outside of Seam and it had a lot of restrictions. It also had a big problem because what people ended up trying to do is put all of their components in the hot deployment loader, which then made it just as slow to start as a normal loader because you have all your classes there, which is kind of not the point.

       

      It was an idea, it worked pretty well. All of the feedback I got back about it was:

      Yep, it works. What we do is we try it. If it works, great! If it doesn't work, we just restart the deployment and that's fine.

       

      I think people were happy with that.

       

      More recently we've been looking at what we want to do to replace this functionality in Seam 3, hopefully working much closer with Jason's team to actually get something that much more built into the the appserver.

       

      You can split this problem into two parts. First, you need to reload the class definition. And then you need hooks into the frameworks so you can reload the metadata that's based on those class definitions. And I don't think a framework like Weld or Seam is a great place to reload the class definitions. That would be something that would be much better done at the lower level somewhere inside the AS.

       

      Of course, in something like Weld, in something like EJB, we need hooks to allow us to reload the metadata about the class that have changed underneath us.

       

      Pete's response is a call to action to address Hot Deployment at a wider level, which is why we have created the Hot Deployment spaces. You should post in the Hot Deployment to provide feedback about using hot deployment and ask questions if you get stuck. The Hot Deployment Development is for discussions around solving this problem.

       

      We believe that Start Douglas' Current state of hot deployment in java library is the right starting point.