In distributed systems, can java's online projects use classLoad and other technologies to achieve hot updates by replacing class files online?

in this scenario, I have a spring boot project A packed into a jar package, which is deployed in three servers of AMagneBPECRIND. Now I find that bug, exists in a class in Project A that the assumption is not to rerelease the code, but to use classload technology to replace the online code to solve bug,. Ask whether it can be implemented now or whether there is a mature and stable solution.

-add

spring boot uses embedded containers, which are not typed into war and then deployed in containers such as tomcat, but jar packages that can be run independently


I remember that the hot deployment of Tomcat is to detect changes in class files and reload them with classload, which is a bit similar to your description, but I have experienced permanent zone memory overflow when I used it before, and it was like this when I analyzed it at that time:

setting tomcat to hot deployment state reload='true' may cause memory overflow in the permanent zone. First of all, the permanent zone stores the class information of the class, and the information reported in the log contains the error message of CGLIB. Check that the dynamic proxy of CGLIB occupies a lot of permanent zone, so add the old class information of tomcat reload to gc, which leads to the memory overflow of the permanent zone.


Why would you do that? Isn't it easier to cluster with docker? a new version released by bug, should be released continuously and there is no need to shut down the service. Remote loading of class is theoretically possible, but you have to write your own classloader, that inherits the default classloader. Have your classloader download class, and load it when it needs to be updated.

Menu