When working with MyEclipse and Eclipse on web projects, I'm used to updating my Java Class, JSP, and/or CSS in tiny increments, pressing Ctrl-S to save the resource, and then refreshing my browser to see the change, all within less than a second per iteration (and this code/test cycle gets run thousands of times a day).
Under the covers the deployment manager takes care of deploying the updated copy of the resource to the servlet container directly to its working location for exploded war archives (for example, in Tomcat, this would be ${catalina.base}/webapps/${contextPath}/**). The app server would then immediately pick up the changed resource and display it (well, in Tomcat if the resource changes twice in under 5 seconds it may take up to 5 seconds after the first resource was deployed for the second update to appear because Tomcat only checks the File.lastModified() at most once every 5 seconds).
Anyway, in STS 2.2 and dm Server 2.0 (M6), I see my update getting written to to src/main/webapp folder (or from target/classes), and then I see the "synchronizing/publishing" and it gets copied to the stage folder (I think this is what the "synchronizing" is doing, I also think this step is called "publishing"). I realize this stage directory is arbitrary and dm server doesn't know anything about it. However, there it just sits. I can even stop and restart the bundle, and nothing. It isn't until I Redeploy the bundle, causing the entire work directory copy of the bundle to be removed, a new copy to be written, and the webapp completely restarted and reiniitialized, do I see my change. Since our webapp takes 45 seconds to initialize, that means my change/test cycle that I do thousands of times a day just went from sub-second to 45 seconds.
Is this the intended behavior of STS and dm Server? I don't know if swapping bundle resources out from under the OSGi container while the bundle is running is allowed (or even part of the spec), or if hot-swapping bundle components is available, but without it, I think the usability of it is broken.
I would hope that for Java classes, that not only does the new .class file arrive in the stage directory, but that also (if you're in debug mode) that the new .class file gets hot-swapped in (I haven't tried it). However, it would be really weird to restart dm Server only to have it revert back to prior code since the updated .class file is still sitting in the stage directory and not actually copied/deployed to the work folder.
So, is this how dm server is supposed to work? What are the alternatives for hot-swapping in web resources and other bundle contents in a live/running OSGi web container?
-J.C.



