What is the underlying theme in OSGi?

谁说我不能喝 提交于 2019-12-02 17:48:17

If you look closer, the concept of classpath in Java really sucks.

You distribute your classes in JAR files, but during runtime Java will (almost) blindly throw all the classes from all the JAR files into one big bag where classes with the same name overshadow each other and then interact in unexpected ways.

OSGi brings a proper runtime modularity to Java platform and on top of that a powerful service model, sometimes referred to as "SOA inside the JVM".

I would strongly recommend reading some introductory articles about OSGi that will give a more concrete idea of what this all means. A good starting point might be the series of articles on InfoQ about Java modularity by Alex Blewitt:

OSGi is

  • A module system for Java: it provides a way of exporting and importing Java packages and enforcing the module boundaries, including explicit dependency and version information.

  • A generalized container for Java systems: bundles can be dynamically loaded and unloaded without stopping the system, where "bundle" is basically jar file.

  • A service-oriented programming system: in addition to modularizing the system by packages, OSGi supports service-oriented modularity, including things like the whiteboard pattern (PDF).

OSGi was originally developed to support high-end embedded systems such as set-top boxes, which motivates the explicit dependencies and versioning, as well as making it fairly lightweight when used as a more recent, enterprise-side container.

whatever benefits OSGi offers, they are overshadowed by the loss in flexibility, the modifications to the build environment and a host of other changes, mostly caused by (highly experienced) developer incompetence.

These impediments will decrease developer productivity and therefore decrease the speed with which all improvements to the sourcecode can be made (not just modularity improvements).

I guess the question can be reduced to 'What is the value of Modularisation'. For an excellent series of articles on this subject by Kirk Knoernschild see http://techdistrict.kirkk.com/. I believe a book is also in the works.

If you are academically inclined - the power of modularity and dynamic system assembly are well explored by a recently published book - "Diversity and Complexity" (http://press.princeton.edu/titles/9208.html). Though not software centric - the book explains why the next generation of adaptive / robust software system will have to be modular.

Note that, in addition to being the industry standard for Java Modularity (so enabling all of the above); OSGi also brings to the table a powerful 'SOA-inside the JVM' Services architecture.

Finally, for a gentle and well crafted introduction to developing in OSGi - try Neil Bartlett's book 'OSGi in Practise' http://njbartlett.name/osgibook.html

Regards

Richard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!