Java 应用程序/线程服务器
我正在寻找具有以下功能的非常接近应用程序服务器的东西:
- 它应该处理一系列线程/守护程序,允许用户启动-停止-重新加载每个线程/守护程序而不影响其他
- 线程/守护程序它应该将库在不同线程/守护程序之间分开
- 它应该允许共享一些库
目前我们有一些遗留代码重新发明轮子......而不是一个完美的圆形代码! 我想使用 Tomcat,但我不需要 Web 服务器,除了简单的后台用户界面 (/manager/html)。
有什么建议吗?是否有非 Web 应用程序服务器,或者是否有 Tomcat 更好的替代方案(例如,更轻量级或更易于配置)?提前致谢。
I am looking for something very close to an application server with these features:
- it should handle a series of threads/daemons, allowing the user to start-stop-reload each one without affecting the others
- it should keep libraries separated between different threads/daemons
- it should allow to share some libraries
Currently we have some legacy code reinventing the wheel... and not a perflectly round-shaped one at that!
I thought to use Tomcat, but I don't need a web server, except maybe for the simple backoffice user interface (/manager/html).
Any suggestion? Is there a non-web application server, or is there a better alternative to Tomcat (more lightweight, for example, or easier to configure)? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您看过 OSGi 吗?您可以加载/卸载 bundles (基本上.jar 文件(带有元数据)彼此独立,并且可以选择定义这些文件之间的依赖关系(定义软件生命周期,以便捆绑包知道正在加载/卸载的其他捆绑包)。
Have you looked at OSGi ? You can load/unload bundles (basically .jar files with metadata) independently of each other, and optionally define dependencies between these (with a software lifecycle defined such that bundles are aware of other bundles being loaded/unloaded).
我发现 Jetty“上下文”概念在处理应用程序(打包为 WAR 并带有 servlet 上下文侦听器)时非常有用,其中放置在上下文中的 xml 文件/充分描述了您想要启动的内容。当您再次删除 xml 文件时,所描述的事情就会停止。
如果您不启动服务器连接器,您只会有一个听起来像您正在寻找的东西的启动-停止。
Jetty 可以做得很小,所以开销也不错。
I have found the Jetty "contexts" concept very useful in handling applications (packaged as WAR's and with servlet context listeners), where the xml-file placed in contexts/ describe fully what you want to have started. When you remove the xml-file again, the thing described is stopped.
If you do not start a server connector you will just have a start-stop thing which sounds like what you are looking for.
Jetty can be made very small so the overhead is not bad.
您可以考虑Spring dmServer。它是一个相当非传统的应用程序服务器,具有非常轻量级的 OSGi 核心(例如,Web 容器是可选的),但它为您提供了类加载器隔离和基本的容器服务。它不是 JavaEE 容器,但附带了插件模块。
您仍然需要自己做很多工作,但是 dmServer 的基础知识非常完善。
You could consider Spring dmServer. It's a rather non-traditional appserver, with a very lightweight OSGi core (the web container is optional, for example), but it gives you classloader isolation and basic container services. It's not a JavaEE container, but comes with plug-in modules that are.
You're stlll going to have to do a lot of work yourself, but the basics of dmServer are very sound.
没有人会阻止您使用 http 协议发送二进制和文本数据而不是 HTML 页面。这就是 servlet 的用途。所以我会使用tomcat服务器。
No one stops you from sending binary and text data instead of HTML-pages using http protocol. That is whats servlets are for. So I would use the tomcat server.