Guest
Welcome login


TIBCOmmunity > Blogs
Home   Members Communities

OSGi

4 Posts
22

OSGi is used in many enterprise solutions and has proven to be very useful. However, once in a while you come across a scenario that is not properly addressed in OSGi or so you think.

 

Consider the following use case:

 

Application A in version 1.0.0 consists of a few bundles and they depend on code provided by library bundle L in version 1.0.0. This looks like a normal start of a new project, so nothing special here.

A 1.0.0 -> L 1.0.0

 

One of the promises of OSGi in contrast to JEE is that you can effectively share code among multiple applications in the same runtime, thereby saving PermGenSpace for classes and heap memory for loaded instances.

 

Using this mechanism, at a later point in time we introduce application B in version 1.0.0 that also depends on L 1.0.0

B 1.0.0 -> L 1.0.0

 

Again, nothing special here, since OSGi wiring allows for this scenario very elegantly. It should be noted here, though, that the introduction of B with its dependency on L has no side effect on A at all. Keep this in mind

 

The tricky part begins when we continue development of A by introducing new features and some bug fixes. A in version 1.1.0 is now newer and better than A 1.0.0, but it also requires a change (say a bug fix) in the common library bundle L, which demands a new version L 1.0.1.

A 1.1.0 -> L 1.0.1

 

The deployment of A in version 1.1.0 does not pose a problem for OSGi, even L 1.0.1 can be installed in parallel as the version of the bundle is different.

 

The question is now: What about application B?

 

If L 1.0.1 provides a bug fix, shouldn't B profit from the fix as well?

 

As a fan of OSGi the logical answer will certainly be: Yes, that would be great.

However, achieving this is easier said than done. In order for B to be wired to L 1.0.1 it would need to be refreshed. A simple restart of the framework doesn't do it, since the wiring is cached and persisted across restarts. Since an existing wire that satisfies the given constraints is preferred over a new wire, there is no automatism that would allow for B to be wired to L 1.0.1 just because it became available.

 

Now, if refreshing B is not so bad, then the discussion ends here. However, in enterprise scenarios, B could be running a very important business logic or even business transaction, which does not allow for a refresh at random times. Uptime of the framework was one of the selling points, but no customer cares about the uptime of the OSGi framework, what matters is the uptime of the application, B in this case. To solve this, there would need to be a time found at which the whole runtime is refreshed in order for the applications to be rewired to the newer version. You may also want to consider removing the old version of the bundle once it is no longer referenced.

 

Coming back to the question whether B should profit from the fix to L as well. If you really don't want B to be interrupted, the answer would need to be no. This demands some form of isolation between application A and B, since an innocent refresh on the runtime may very well cause the unwanted side effect of B getting wired to L 1.0.1.

 

This leaves you with a new metadata problem. Your application B may have stated its dependency on L using a version range of

[1,2)

according to OSGi best practices, but some other higher level entity made the decision not to disrupt the application B at all. The only solution would be for A 1.1.0 to bundle L 1.0.1 in itself and not exporting the packages from L 1.0.1 to anyone else. While entirely logical and consequential, it puts a great burden on the maintainers of A (developers, deployers) and a lot of common knowledge about the side constraints of B, which A shouldn't really need to care about. Another side effect is that you no longer have a consistent class space in the framework such that any interaction between A and B that has worked before will now throw ClassCastExceptions as the classes are no longer compatible.

 

From previous discussions with Peter Kriens I learned that I can't have the cake and eat it too. Unfortunately, that is exactly what some customers want and they don't always care how we deliver this to them Sounds familiar?

 

But, there is hope.

The CPEG is working on scoping solutions that allow for different application bundles to be completely isolated. There will be no interruptions in the lifecycle, and it will be possible to share classes among multiple applications. The composite bundle specification is still in the works, but it sounds like a life saver for a lot of enterprise scenarios. See RFC 138 if you have access to OSGi documents. All OSGi Alliance member companies do automatically regardless of membership level.

 

One of the drawbacks even with the composite bundle solution is that you still increase the memory footprint if you provide multiple versions of the same bundle(s) as described above. In that, OSGi is no better than any JEE application server.

 

However, there is one thing one can do to minimize the disruption. And that it to decouple interfaces from implementation and model dependencies based on services rather than implementations. It is quite logical that interfaces change much less frequently than implementations.

 

So, if the example from above was to look slightly different:

A 1.1.0 -> L 1.0.1, C 1.0.0 and B 1.0.0 -> C 1.0.0

then A could install as many fixes as it wants as long as it does not change the interface contract defined in C 1.0.0. Provided that B has now modeled a service dependency on C that A implements, B should not be interrupted significantly by the fact that A 1.0.0 is replaced with A 1.1.0. It's all in the metadata and proper dependency management

 

Hope this was illustrative about some of the challenges enterprises face in the real world.

 

As you were,

 

Tim.

 

22 Comments Permalink
0

OSGi DevCon 2010

Posted by Tim Diekmann Dec 22, 2009

It is this time of the year again, when the call for submissions to EclipseCon and OSGiDevCon went out and were answered numerously.

 

OSGi DevCon 2010 will be again hosted together with EclipseCon 2010 in March in Santa Clara, CA. Register early to get a significant discount as alumni or OSGi Alliance member.

 

This time, I was honored to be asked to join the program committee of OSGi DevCon. Together with Andreas Kraft, Christer Larsson, Mike Francis, and Peter Kriens we went over all submissions to find a good balance and interesting program. We haven't finalized the program yet, but we are getting closer to a consensus about the allocation of the time we were given.

 

I must say I am impressed with the variety and quality of the proposed talks. If I had the chance, I would go to all of them. Unfortunately, we will need make some choices and disappoint a lot of potential speakers.

 

The final list will be published beginning of 2010, so stay tuned.

 

Tim.

 

0 Comments Permalink
2

With the release of the Enterprise Profile beginning of 2010, this is not the end of the EEG

 

Our agenda is full and in full steam. In the next meetings we will go further into the details of

  • Subsystems, or what is commonly referred to as 'applications'. After agreeing on the requirements we are now commencing the detailed design work

  • OSGi Bundle Repository (OBR). This relatively old spec is now being worked on again after we have agreed on the requirements and mandated the detailed design work

  • Namespace. The support for namespaces was left out of the Blueprint spec in R4.2 and will now be completed

  • Weaving. The support for byte code weaving is essential to many specs, but quite difficult to do right.

  • Web Container API. The current spec does not allow for programmatic web app creation yet.

  • Multiple Extenders. The more extenders we have in the system, the more their interaction needs to be coordinated or the system becomes unpredictable. We have agreed on the requirements and start detailed design work now.

  • Asynchronous Communication. The integration of JMS and other pub/sub, request-response, etc. technologies will be a major part of the next OSGi version

... and many more interesting technologies.

 

You may also be interested to learn that OSGi APIs are finally catching up with JAVA 1.5 constructs. Thanks to interesting compiler options like -jsr14 it becomes possible to use Generics in the API while still providing backward compatibility for the mobile users, who's APIs are limited to 1.4.

 

Stay tuned,

 

Tim.

2 Comments Permalink
3

Welcome to my OSGi Blog @ TIBCO.

 

If you are looking for TIBCO specific information about OSGi, then I have to disappoint you. This blog is meant for communicating Enterprise Export Group related information to the greater OSGi community. The EEG is open only to OSGi Alliance members and it is up to the group members and especially the chair-men to open up the communication and information flow.

 

You may have heard that my co-chair since the inception of the EEG in late 2006, Eric Newcomer, has moved on to new responsibilities, which unfortunately do not allow him to stay involved in the OSGi work. I am very grateful to Eric for his help and mentorship.

However, we are very happy to have found an excellent successor in David Bosschaert from Progress Software.

 

Ok, back to business.

 

For the last three years the Enterprise Expert Group has worked on integrating mostly J* specs with OSGi in a manner that makes it easy for JEE developers to run existing JEE applications in OSGi while at the same time with only minimal adjustments to the design to allow for making optional use of the unique OSGi capabilities. One example of this adaptation is JNDI. For the JNDI spec, we have come up with an elegant way of using JNDI capabilities through services, while at the same time allowing for existing hard wired application to run in OSGi in "traditional" mode. You may also read this as "classic" or "legacy" depending on where you stand on the JEE vs. OSGi debate. In a similar fashion we have worked out the integration of JPA. Others map easily and elegantly without a lot of complications, e.g. JTA and JDBC.

 

In addition, in the enterprise profile we introduce new capabilities to OSGi, which are not driven by JAVA specs, i.e. Remote Services and Remote Service Admin Service. These powerful concepts allow for scaling of OSGi services across JVM boundaries and open up a whole new set of designs and use cases.

 

What is the Enterprise Profile now?

Glad you asked. Let me start by saying what it is not:

 

It is not an all-or-nothing specification document that requires compliant implementations to support every service listed. As such there is no single TCK that can be run against an implementation to claim compliance.

 

Instead, the profile is a collection of services from the core, compendium, as well as new enterprise driven services, which will ultimately be part of the compendium itself. The Enterprise Profile is the first point of reference for enterprise developers looking for guidance in the vast amount of spec documents. The first question someone new to OSGi typically is driven by is

 

'What is relevant to me? Do you expect me to read the entire 400 pg. core spec plus the 800 pg. compendium stack before I can do anything useful with it?'.

 

The introduction chapter to the spec is trying to put the services in context with typical use cases that developers can follow and identify themselves with. The following chapters are literal copies of the relevant chapters from the core and compendium specs for easy reference.

 

When you download the current draft you will notice that the list of included services seems incomplete. Indeed it is. The final version will also include already published and final specifications like Configuration Admin Service and Blueprint.

 

Where can you find the public Enterprise Profile?

The public interim draft can be found at the public OSGi web site for download by everyone.

 

In the near future we plan to release the final version and make it available for the general public. We encourage the OSGi community to take advantage of it, try it out, and provide valuable feedback about what works and what does not.

 

Stay tuned for more updates of the EEG at this location.

 

Tim.

3 Comments Permalink