Reputation: 2456
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.
thank you!
Upvotes: 4
Views: 1154
Reputation: 15372
Today, OSGi has basically no overhead, the frameworks range from 350k to 1mb. In runtime, OSGi stays out of your way.
You should take a look at bndtools, it provides a very nice development environment for OSGi bundles including launching, debugging, and testing. You can easily switch between frameworks.
You can find bndtools in the Eclipse marketplace.
Upvotes: 3
Reputation: 3641
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.
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!
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.
Upvotes: 5
Reputation: 533530
I use karaf/iPOJO as an OSGi container to allow upgrading versions of libraries while the application is running.
However, for a small application which you can restart any time, I would keep things as simple as possible.
Upvotes: 3
Reputation: 3096
OSGi has still a "little" more overhead than regulare Java projects. I would instead rely on Maven modules, if you wanna have versioning.
If you choose the OSGi apporach take a look at the Eclipse plugin creation. This is based on Eclipse Equinox and can be applied to new projects fast by the wizzards Eclipse offers for creating new projects.
Good luck!
Upvotes: 2