在小型Java应用程序上使用OSGI框架是否合适? [英] Is it appropriate to use OSGI framework on small java app?

查看:81
本文介绍了在小型Java应用程序上使用OSGI框架是否合适?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计划要用OSGI框架重新实现我的一个小型但有用的应用程序.我从未使用过它,所以我问在小型应用程序上使用OSGI是否合适,并且在使用此类框架时在速度或/和内存占用上是否有很大差异.另外,如果这是一个不错的选择,我会问哪种实现最适合小型应用程序.

I have a plan to reimplement one of my small but usefull applications with OSGI framework. I never used it, so I ask is it appropriate to use OSGI on small app and is it a big difference in speed or/and memory footprint when using such framework. Also if it is a good option I would ask what implementation is best for small applications.

谢谢!

推荐答案

对于现代计算机系统,OSGi的速度和内存占用量根本不重要:记住OSGi是为资源受限的设备开发的.内存占用空间为数百kB,一旦完成服务解析,该框架就不会影响应用程序的速度(例如,没有代理).简而言之,运行时无后顾之忧.

For modern computer systems, speed and memory footprint of OSGi are of no concern at all: remember that OSGi was developed for resource-constrained devices. The memory footprint is in the hundreds of kBs, and once the service resolution is done, the framework has no impact on the speed of your application (for instance, there are no proxies). In short, no worries at runtime.

我喜欢正确设计的OSGi应用程序通过迫使您考虑模块和服务来清理应用程序结构的方式.在这里,我将远离模块化和面向服务的所有好处,只记得它们既适用于小型应用程序,也适用于大型应用程序.嘿,您甚至可能开始找到可重用的组件!

I like the way a properly designed OSGi application cleans up the application's structure, by forcing you to think about your modules and services. I will stay away from all the benefits of modularization and service orientation here, just remember they apply just as well to small applications as to large. Hey, you might even start to find reusable components!

需要考虑打包和运输您的应用程序:根据您的听众,您可以只运输一捆捆绑物,使用shell脚本使系统运行(使用例如 Pax Runner ),或者您可能需要投资一些更新颖的东西,例如使用图标.

You will need to think about packaging and shipping your application: depending on your audience, you can get away with just shipping a bunch of bundles, using a shell script to get the system going (using e.g. Pax Runner), or you might need to invest in something a little more fancy, like nice application packaging with an icon.

这篇关于在小型Java应用程序上使用OSGI框架是否合适?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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