Java - 热部署 [英] Java - Hot deployment

查看:106
本文介绍了Java - 热部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我正在阅读有关具有热部署功能的Erlang的书。可以在不使系统关闭的情况下进行部署。所有现有的请求将由旧版本的代码处理,部署后的所有新请求将由新代码提供。在这种情况下,可以在运行时间内提供所有旧请求之前的代码版本。在Java中有哪些方法可以保存2个版本的jar文件?有没有任何应用程序/网络服务器支持这个?

解决方案

有很多方法可以在Java世界中实现热部署,所以你这可能需要更具体地反映你的上下文和你想要实现的目标。



这里有一些很好的潜在客户/选择:




  • OSGi 是一个支持热部署的通用模块系统

  • Clojure 是一种动态JVM语言,实现了很多运行时交互。 Clojure经常用于实时编码 - 几乎任何东西都可以在运行时被热交换和重新定义。 Clojure是一种强调不变性和并发性的功能语言,所以在某些方面与Erlang有一些有趣的相似之处。 Clojure有一些非常好的网络框架,如 Noir ,适合热插拔网络代码。

  • Play Framework 旨在为生产力原因启用热插拔代码(避免重新启动Web服务器)。如果您主要关注热插拔Web应用程序,可能会相关。

  • 大多数Java应用服务器,如 JBoss 支持某些形式的热插拔Web应用程序。


Recently, I was reading book about Erlang which has hot deployment feature. The deployment can be done without bringing the system down. All the existing requests will be handled by old version of code and all the new request after deployment will be served by the new code. In these case, both the versions of code available in runtime for sometime till all the old requests are served. Is there any approach in Java where we can keep 2 versions of jar files? Is there any app/web servers support this?

解决方案

There are many ways to achieve hot deployment in the Java world, so you'll probably need to be a bit more specific bout your context and what you are trying to achieve.

Here are some good leads / options to consider:

  • OSGi is a general purpose module system that supports hot deployment
  • Clojure is a dynamic JVM language that enables a lot of runtime interactivity. Clojure is often used for "live coding" - pretty much anything can be hot-swapped and redefined at runtime. Clojure is a functional language with a strong emphasis on immutability and concurrency, so in some ways has some interesting similarities with Erlang. Clojure has some very nice web frameworks like Noir that are suitable for hot swapping web srever code.
  • The Play Framework is designed to enable hot swapping code for productivity reasons (avoiding web server restarts). Might be relevant if you are looking primarily at hot-swapping web applications.
  • Most Java applicatio servers such as JBoss support some form of hot-swapping for web applications.

这篇关于Java - 热部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆