Here’s some thoughts of mine about OSGi after refering some articles(here and here).
OSGi is a system which provides runtime module management for Java. It can install, start, stop, update and uninstall the Java module(s) at runtime, which is absent in the standard Java/VM environments.
The values of OSGi:
Runtime module management without rebooting the JVM, which is important in some scenarios;
Explicit dependencies and explicit exposed services/interfaces for each OSGi bundle make the applications/systems rely on OSGi platform more modularized;
Anything else?
An OSGi bundle file is just an ordinary jar file with some specific items in the “manifest.mf” file, and it may implementing some specific OSGi interfaces, such as “org.osgi.framework.BundleActivator”.
I’m wondering if there’s any alternative of OSGi in the other more dynamic languages, such as Ruby, Python. In another word, is it necessary?
The most popluar OSGi implementation is Felix, which is just 1.2MB. Here is the step-by-step examples of it. And this is the commands how I create one example and run it:
1 | # 1. Create the directory structure. |