I noticed that both options are available while running Jboss, and they both recompile the project (I noticed 'make' running with both). I did see this question, the accepted answer made sense, but I wasn't sure what hot-swapping means. What is a possible example of a change which could be registered without needing to restart the server?
-
What do you mean "they both recompile the project:. Are you using Maven/Ant to manage JBoss? Or maybe Eclipse/NetBeans/...? – JScoobyCed Aug 21 '13 at 02:00
-
I'm using Maven, forgot to mention. – Siddhartha Aug 21 '13 at 02:21
1 Answers
Your question needs more details to answer completely, but here are some basic concepts:
- Hot-swapping is simply replacing the files of your project into the deployment folder of the application server (unpackaged, i.e. not the .war/.ear but all separate files). It is usually faster because the change are immediately visible in the web-application. But it is not always possible/supported by application servers, and often if you hot-swap .jar files the application server doesn't pick it up or end up confused.
- Restarting JBoss will stop all existing services ( EJBs, Pooling, Queues, Messaging...) and restart them. It is almost the cleanest way to run your application (the cleanest would be un-deploy, restart and deploy)
- Redeploy means your application and its services are first removed from JBoss, but other services setup at server level (Messaging, Pools, JMX,... depends on your actual settings) are still deployed. Then the application is deployed (copied from your dev folder or .WAR/.EAR to JBoss webapp)
Typically, you would hot-swap (eventually manually) .(x)html/.jsp/.jsf/images/.js/.css safely as JBoss doesn't need to process them. Changing code in java classes deployed as .class in a WEB-INF/classes can often be hot-swapped.
Changing code in java files deployed as .jar will almost always need at least redeployment. Some OSGi enabled application server properly configured are more flexible in hot-swapping a complete application (I know Glassfish does but I don't know what specific setting is needed)
Finally, in development, sometimes the multiple redeployments lead to memory leak or unstable application server (often you'll get a OutOfMemory exception in the logs) then you need to cleanup (undeploy, stop, start then deploy)

- 10,203
- 6
- 34
- 58
-
I see, so it's a question of JBoss supporting it, and the file format. Thanks for the answer. – Siddhartha Aug 21 '13 at 02:23
-
The OutOfMemory exception seems to be gone or way better in JBoss EAP 7/WildFly 10 - fingers crossed as that was annoying! – JGlass Aug 10 '18 at 21:18