用于热代码部署和调度 jar 文件部署的 Java 框架
使用JAVA框架我想实现以下任务。
- 热代码(jar)部署将在环境中执行某些任务
- 。任何时候,如果我更新该 jar 文件,它应该自动卸载旧代码并加载新代码,
- 我想安排已部署的 jar 文件来执行任务。
目前我看到 Apache karaf/Felix 满足了这一要求,但可用的帮助较少且难以管理。
我可以使用任何替代框架来代替 karaf/felix 吗?
Using JAVA framework i want to achieve the following task.
- hot code(jar) deployment which will perform certain task in an environment
- At any time if i update that jar file it should automatically unload old code and load new code
- I want to schedule that deployed jar file to perform tasks.
Currently i see Apache karaf/Felix fulfill this requirement but less help available and difficult to manage.
Any alternate framwork i can use instead of using karaf/felix ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果你不打算走 OSGi 路线,你基本上是通过放弃 Karaf / Felix(Karaf 默认使用 Equinox)来暗示的,那么我可以建议你考虑的最好的事情就是 LiveRebel 发布时。 @Daniel 的回答提到了 JRebel,它在开发过程中的热部署方面非常出色,但它并不是一个工具。对于生产系统。相反,您应该查看同样由 Zero Turnaround 制作的 LiveRebel,也许能够满足您的需求。请注意,这是一个商业产品,但他们现在提供私人测试版。
[编辑]
白痴的是,我忘了提及还有 Knoplerfish,另一个具有 BSD 的 OSGI 运行时风格许可证。也许尝试一下?
If you aren't going to go the OSGi route, which you basically implied by forgoing Karaf / Felix (and Karaf uses Equinox, by default) then about the best thing I can suggest for you to consider is LiveRebel when it comes out. @Daniel's answer mentioned JRebel, which is outstanding for hot deployment during development but it is not meant as a tool for production systems. Instead you should check out LiveRebel, also made by Zero Turnaround, might be able to fulfill of your needs. Please note that this is a commercial product but they are offering a private beta right now.
[Edit]
Idiotically, I forgot to mention that there's also Knoplerfish, another OSGI runtime which has a BSD style license. Perhaps give that a shot?
尝试一下JRebel。这是一个很棒的工具。
Give JRebel a try. It is a great tool.
请注意您所指的环境(例如网络、桌面、服务器端等),但是……
逆向工作:
3:计划任务
您可以使用 Quartz Scheduler 库 在任何 Java 容器中实现此目的。这允许您以类似 CRON 的方式安排事件。
1-2:热部署
那么就是你要部署在哪里以及如何处理热部署的问题。其他答案提到了 JRebel 和 OSGI 可以工作。如果您想要一些超快速的部署(例如,保存代码并使其可用)并将其托管在 Web 容器中,则使用 播放框架。它使用 Quartz 以非常好的方式实现计划作业。
例如(来自 Play 文档):
Note sure what environment you mean (eg. web, desktop, server-side, etc), but...
Working backwards:
3: Scheduled Tasks
You can achieve this in any Java container with the Quartz Scheduler library. This allows you to schedule events in a CRON like fashion.
1-2: Hot Deployment
Then it's a question of where you want to deploy and how to handle hot deployment. Other answers have mentioned JRebel and OSGI which will work. If you want some super quick deployment (eg. save the code and it's available) and have it hosted in a web container ,then use the Play Framework. It uses Quartz do implement Scheduled Jobs in a very nice way.
For example (from the Play docs) :
JBoss 具有您所描述的热部署功能。然而,我猜配置 Karaf 也很复杂。不过,也许可以了解 JBoss 如何实现它并自己使用这些库。
JBoss has the hot deploy feature that your describing. However, I'm guessing it's as complicated to configure Karaf. It may be possible to find out how JBoss is achieving it and use the libraries yourself though.
简而言之,热部署/重新部署是这样完成的:
<小时>
有很多允许动态部署的框架
In a nutshell, hot deploy/redeploy is done like that
There are a lot of frameworks that allow dynamic deploy
大多数 Web 容器(如 Tomcat 或 Jetty)的热部署功能允许您在 Web 应用程序上实现您想要的行为。
这样的应用程序可以非常简单,本质上只包含您的 jar。
您需要您的应用程序做什么?
The hotdeploy feature of most web containers (like Tomcat or Jetty) allow you to have the behaviour you want, on web applications.
Such an application can be very simple, and essentially just contain your jar.
What is it you need your application to do?