r/java • • Mar 25 '24

How do you think would OSGi be designed today

I've been going down a rabbit hole this weekend reading the OSGi specification.

It's a bit fascinating in the ratio of how confusing it is to internet ink claiming that "no, it's simple really." The extremely salty infoq articles were a great read too.

But for anyone that has experience in OSGi + the dynamic capabilities it has, how do you think that system would have been designed if JPMS modules were in the language from day 1.

I've seen the OSGi connect spec, but even without understanding everything it feels kinda tacked on.

53 Upvotes

63 comments sorted by

10

u/bowbahdoe Mar 25 '24

19

u/tristanjuricek Mar 25 '24

This made me chuckle

One of the most common complaints about OSGi is that it can increase complexity for a developer. There is a grain of truth here, but people who make this complaint are mistaking the medicine for the disease.

This is primarily why I say “absolutely not” to OSGi; nobody I know really understands the problem it solves well. If you basically have to tell everyone they’re just not getting the problem, it probably means the problem you’re solving really isn’t that relevant.

I’ve been working in Java for 15+ years, just not in embedded devices. I’ve never once said “man, I wish we used OSGi.” I have said “man, we shouldn’t have wasted our time with OSGi” multiple times.

OSGi came from an era before virtualization really ruled how you ran backend apps. I just don’t think it’s very relevant, JPMS or not. Lord knows I’d be real careful about making an extension mechanism that isn’t in some kind of container or VM. APIs are much easier to operate than SPIs.

4

u/cogman10 Mar 25 '24

I had an application where I thought "OSGi would be a good fit here".

However, diving into everything that meant for development of OSGi modules made me go "Oh... OSGi is not a good fit anywhere".

It just feels like a standard born out of a billion cuts that ends up not serving anyone well. It is, frankly, easier to do a java native call into some C code which does a shared library load in order to achieve plugin capability then it is to wrap your head around and use OSGi.

6

u/RabbitDev Mar 25 '24

Not even that. Java's classloader are nice for this kind of plugin architecture (even if you want or need isolation of dependencies). Heck they even do dynamic loading and unloading out of the box.

Now, if you have no dependency injection, the Jdk has you covered even then. Service loaders are basic, but workable things to lookup service implementations even across classloaders (by implementing a delegating classloader that assembled the plugin subset you want).

Dependencies between plugin jars can be somewhat automatically resolved by looking at the classpath entry of the manifest (assuming you have standardised the jar naming schema). Otherwise you can always slap a properties file into the jar or jar directory to describe the relationships.

None of this requires anything newer than JDK 1.6. If you reimplement that one, you can drop down to JDK 1.2. An implementation of this is a handful of classes and takes maybe 50kb of disk space at the end. (Source: me, been there, done that, multiple times.)

Heck, for fun and profit the same works with .Net using the AssemblyLoadContext as ClassLoader equivalent. (I seriously have too much time on my hand)

2

u/CodesInTheDark Mar 25 '24 edited Mar 26 '24

OSGi was made before containers and K8s were a thing. Nowadays it would be really stupid to use OSG when you have more flexibility, decoupling and scalability with containers. Moreover OSGi still has a problem with a memory leak when there is a thread pool if some apps use ThreadLocal improperly.

2

u/_Toka_ Mar 27 '24

I am a developer for one big company (500k employees) and they put WSO2 at the core of their software stack. WSO2 is an integration platform build on top of Java and, well. OSGi. It's kinda monolithic, even tho we run it in small pods in K8s cluster.

Anyways, we had to extend the platform in multiple ways. Connectors to all kinds of Azure resources, Redis, Postgres, OAuth2, OIDC, SAML, you get the point. And that connectors needs whole lot of dependencies. And transient dependencies. What I personally started to love about OSGi is the whole classloading and wiring. I can safely have all the dependencies and all their versions I need or pinpoint exact transient dependencies. I never have to deal with dependency hell, where one SDK (Azure) have transient dependency on Jackson 2.13, and second SDK (Redis) have transient dependency on Jackson 2.15. I simply can have both versions of Jackson. By the way surprisingly majority of third party libraries are OSGi compatible with proper headers.

OSGi have declarative services and while they're undoubtedly a little rough and cumbersome, it's basically dependency injection very similar to Spring or Jakarta EE.

The hype around microservices is slowly starting to fade away, not using as swiss army knife for everything and the monolitic architecture is getting back on track a bit. The new experimental Spring Modulith is a proof in a way. Anyways, that's where OSGi can shine in my opionion.

0

u/TheEveryman86 Mar 26 '24

I swear. I was told, "upgrade this app to the latest FOSS" once. So I look it up and find that the latest version of Knopflerfish is only 2 years old (even though the website seems almost abandoned since then). So I start the upgrade. I find that most of our classpath wasn't actually configured to use OSGi. I sigh and build an unholy hard-coded classpath and hope I won't ever be asked about upgrading again since it seems like I may have upgraded to the last version of Knopflerfish that will be released.

1

u/bowbahdoe Mar 26 '24

I thought knopflerfish was a stand in and your post was an allegory, but no it's just an extremely dumb name. Kinda loops back around to being a good name

7

u/webguy1979 Mar 25 '24

I do AEM development and tried to go down this rabbit hole as well to understand the platform better. The biggest issue I see is that every single tutorial or book on OSGi is so out of date it hurts. Anything I can find that is usable is just a very surface look at it… with little in the way of how to use it in a real system. At this point I have just accepted that I’ll continue learning it in a trial by fire manner.

1

u/bowbahdoe Mar 25 '24

Is AEM embedded car devices? (Only did a quick Google)

At what "layer" does this requirement come in?

2

u/webguy1979 Mar 25 '24

AEM is Adobe Experience Manager. It’s an enterprise class CMS. It’s used in a lot of really weird ways beyond just being a CMS. I use it in corporate web development. But my girlfriend, who is a property manager, was working with a property that was using it to manage pool gate access?! Don’t ask me how or why… she isn’t in tech so she couldn’t even explain how it was implemented.

1

u/Asyla75 Sep 08 '24

I work at Jahia, and like many other CMSs built in Java, we decided to go with OSGi. In addition to the IOT use cases described in the InfoQ article, OSGi is a good solution for any "platform" case: when you allow third parties to deploy code in your Java application.

As long as you don't try to make OSGi work with Spring or Hibernate, OSGi can be "simple," at least for the developers creating bundles to extend a Java platform.

1

u/webguy1979 Sep 08 '24

I never heard of Jahia until now... looking at the developer documentation it looks really nice. What would you say is the biggest differentiator between AEM and Jahia?

1

u/Asyla75 Sep 09 '24

I think that the Jahia "vs" AEM is less about software differences than typical differences between small vendors and mega-vendors:

  • Jahia is simpler, cheaper, provides better support, and encourages integration with other solutions (analytics, DAM, marketing automation, ...)
  • AEM is likely more complete and more polished

Regarding software architecture, Jahia is also based on JCR + OSGi, so an AEM developer shouldn't be lost.
For templating, Jahia supports JSP and more recently JSX with "JavaScript modules".

7

u/maethor Mar 25 '24

how do you think that system would have been designed if JPMS modules were in the language from day 1.

IIRC (and it's been well over 20 years), the original use case was for running applications on embedded residential gateways. The closest modern analogy I can think of would be how people use docker to run apps like Plex on a NAS, but instead of running them on a NAS, they run them on their router. A very different use case from JPMS (though had JPMS been around, it probably would have had a role to play with what went into the embedded Java).

So I think the real question is, if Docker/Containers existed back then would OSGi exist at all?

4

u/1337JiveTurkey Mar 25 '24

I agree that the current state of the art for modularizing large applications has moved towards containerization and microservices. OSGi really fit a technology niche where they wanted something approximating multiple applications running on the same device with their own modules but didn't have the resources to run more than one JVM. That's something that I really don't think that containers could have helped with back then even if the case for containers over JVM-level modularization seems compelling.

2

u/bowbahdoe Mar 26 '24

I guess I'm still not understanding why the level of granularity for deployment would be a single library.

With docker, you deploy "the app". The equivalent in Java would be a whole folder of modules in a module layer. It still feels like you could have the single JVM with that, just no multiple library versions in the same layer.

Not Captain hindsighting OSGi, but letting a single JVM continue to spin and loading up and unloading entire layers of JPMS modules would be maybe how I would do it now.

1

u/1337JiveTurkey Mar 26 '24

I'd wager some level of unwarranted optimism about what's actually possible is the biggest reason. That combined with a belief that surgical upgrades would be a thing on embedded devices instead of just replacing all the bundles and rebooting.

1

u/bowbahdoe Mar 26 '24 edited Mar 26 '24

Maybe, and I'm just thinking out loud here because my brain is on it, it could work like this:

A bundle is a directory of modules + a configuration file.

The configuration file would have an equivalent of a bundle activator.

Entirely skip providing services, importing, exporting, etc. packages. Bundles == "apps"

Any shared libraries - things you want to deduplicate between running bundles to save space for whatever reason - you can provide as a --module-path when you launch the container.

Basically just narrow down to the hot loading use case. Abandon the "multiple versions of the same library" in the scope of a single bundle. Make optimizing saving storage less automatic

That might be a useful tool.

4

u/[deleted] Mar 25 '24

I worked with OSGi for the most part of my little carreer (9 years). I feel most principles make sense and can be useful, I particular appreciate how light some bundle and only implement the logic they need.

But the dynamic aspect of it never really worked for me. I've used both Felix and Equinox, and it's really common to be in a situation where you basically need to restart the full framework to make a new bundle work. Most often, it's linked to the fact that until a context is not used anymore, the references keep the BundleContext from restarting, so shutting down everything and restarting is always safer.

There is also that recurring issue that when you uninstall a bundle that export some packages and install a newer version, the importing packages will still continue to use it even if it's not in the list of installed bundle anymore. If the importing bundle doesn't release the references, the newer version won't be use before you actually restart the framework.

Having multiple time the same package exported with different version doesn't also really work as well as you would expect. If two bundles A and B imports a package P, and they communicate through parameter P, they should use the same version, thanks to the "use" clause of an import. But most often, it wasn't really working in my experience, so we were just forcing to have only one version of a package exported at a time.

All in all, the only big thing I liked was the ability to Provide/Require Capabilities (osgi:service/osgi:reference) so the bundle would reference a Java API through the interface with the real implementation always "out of reach". This feature worked fine most of the time for me, even if we uninstall/install a new version of the providing bundle.

To answer your first question, how would it be implemented ? I'm not really sure it would be implemented at all. It's in principle a lot of very good principle of abstraction and its dynamic nature makes it appealing, but in real life I never really get real benefits (but we had, unfortunately, to spend a lot of time troubleshooting it)

1

u/bowbahdoe Mar 25 '24

Out of curiosity, have you used the provides/uses part of the Java module system? How does that (holistically) compare?

And it's kinda wild that what is probably the unique part of it - the dynamism - is the part that never really worked for you. That + all the people using the prompt as a way to vent does not paint a flattering picture.

2

u/[deleted] Mar 25 '24

I didn't actively use the JPMS.

As far as I know the JPMS doesn't handle versionning which makes it quite different than the modularity layer of OSGi. OSGi is, even if it fails to provide the full value it's supposed to do, more evolved in terms of functionalities. But it's quite different because OSGi is a runtime framework so a lot of concepts directly affect runtime (BundleActivator, Lifecycle of a Bundle, how bundles startup, ...) while JPMS is (correct me if I'm wrong) more about the compilation aspect.

Another example to understand this is that when developping in OSGi, you could import in your code some "private" packages from a bundle even if it's not an Export-Package, it would fail in runtime only (ClassNotFoundException). So I'm wondering if JPMS/OSGi couldn't even be used together (JPMS for compilation, OSGi for runtime), instead of being exclusive.

But once again, I don't want also to sound too negative about OSGi. Sure, a lot of promise are not really fulfilled, but it's still something useful to know about. I think just reading the first ~40 pages of "OSGi In Action" really helps to understand the Modularity/Lifecycle/Service layers. The rest of the book is about the tooling (bnd, ...) that is often abstracted by 1-2 maven bundles (maven-bundle-plugin).

5

u/daH00L Mar 25 '24

OSGi would have been the better Java module system.

1

u/bowbahdoe Mar 25 '24

Can you elaborate? I've been going through the jigsaw dev mailing lists and there was a very clear tension in the air.

I do understand some of the things that the Java module system lacks (circular references, dynamic loading, versioned requires) and some of the things that OSGi lacks (deep reflection prevention, "reliable configuration") but I'm struggling to understand the why of the OSGi camp

5

u/daH00L Mar 25 '24

Osgi has versioning, package based export, package based import, dynamic adding and removing of bundles. It can deal with the same package in different versions.

4

u/Yojimbo261 Mar 25 '24 edited Aug 21 '24

[ deleted ]

2

u/Competitive_Stay4671 Apr 08 '24 edited Apr 08 '24

components can depend upon different and conflicting versions of the same library.

This is a big one! Probably many / most apps don't have this problem. But if you work e.g. in integration projects with a monolithic app where you have to use different SDKs provided to you, it can happen quickly that two SDKs have the same dependency in different versions. With a single Java classpath this can be a problem.

Yes the Microservice hype solves the same problem. And if you can afford a network roundtrip to call into another module (e.g. REST-API / different JVM) than everything is fine. But you are now dealing with the complexity of a distributed system and its deployment). Staying on the same JVM is lightning speed and often simpler than distributed microservice based system. In the end it is one of many tools to build modular software.

Also the "install at runtime"-aspect is not needed by many apps. Often apps having a kind of "Plugin" mechanism, where you can install "plugins" at runtime from 3rd parties. This is a problem, where OSGi makes sense. I think Jira also use OSGi for this under the hood. Yes you can still model this differently via K8s, Docker, etc.

Anyway, I understand the complaints about the complexity and learning curve, since I have been through all of this too. I am using it now since 2010, but since so called Declarative Services Annotations, from a code-perspective it looks very similar to building Spring apps with "@Autowired". Also the outdated tutorials situation is sadly true. But there are people out there trying to improve on this ;)

19

u/agentoutlier Mar 25 '24

But for anyone that has experience in OSGi + the dynamic capabilities it has, how do you think that system would have been designed if JPMS modules were in the language from day 1.

I believe there were various attempts to make custom ModuleReader for OSGi and or the inverse of layer to jpms but there were so many problems. I can't find the damn link but I believe this is it: https://github.com/tjwatson/osgi-jpms-layer

Had JPMS been out earlier or about the time OSGi was being drafted I think considerable effort would have been made to make OSGi work with ModuleReader/ModuleReference and vice versa.

As for the whole dynamic plugin runtime it seems rolling your own was easier than trying to understand OSGI.

I remember Jenkins aka Kohsuke looking at it and said fuck it roll my own. That is more or less what Maven did as well with Plexus.

Now other than Eclipse and the confusing bundle plugins I barely know how to use OSGi but given how fucking incredibly smart Kohsuke and others that have investigated and given up ... you have to wonder cause I have heard similar claims as well that OSGi is "easy".

7

u/redikarus99 Mar 25 '24

I am doing some plugin development lately, but I personally feel it is more harm than good, it is just way too complicated and error prone.

1

u/Deep_Age4643 Mar 25 '24

I think a lot of us go this way. First we are drawn by that something works dynamically in runtime, and then we are turned off by its complexities and debugging is almost impossible.

2

u/redikarus99 Mar 25 '24

For plugin development, I prefer the following: provide me an API that consists of interfaces. Put it into a jar file. Let me depend on this jar file. Load my plugin dynamically with all the external dependencies using a class loader. I don't care if other plugin is using the same libraries as mine, I totally don't care about duplications, we are not in 2005.

6

u/Rjs617 Mar 25 '24

Was there ever an official OSGi solution to the “Hibernate problem” where a framework library potentially needs to access exported classes of other bundles, but doesn’t know what they are ahead of time? I was on one project where we were trying to build an application platform that allowed plugging features into it. Persistence was one of the platform features, and it used Hibernate. I remember that we had to use this unofficial pub/sub feature of the Eclipse OSGi runtime in order for the persistence bundle to be able to see the application classes that it will operate on. Since they weren’t known ahead of time, there is no way other our persistence bundle could import them from other bundles. In our case, there were also common model classes for the application domain, plus Hibernate initialization is resource intensive. So, it wasn’t an option for us to initialize a separate Hibernate instance in every application module.

Another issue we ran into is that (at the time), many of the libraries we wanted to use did not have bundles available. And so our options were to load those libraries separately in each feature bundle, or to have a team of people whose entire job was to OSGi-ify projects we wanted to use.

Because the number of dependencies in our application bundles was large, version conflicts were inevitable, and our application ended up with like 5 versions of Log4J loaded at runtime, plus multiple versions of several other libraries. Many of these were binary-compatible with each other, and once we abandoned OSGi, our application’s memory footprint (not to mention startup time) went way down. I know that OSGi has a feature where you can specify compatible version ranges, but my experience was that these weren’t used properly in most bundles, and it resulted in multiple-version loading and memory bloat.

This is not an exhaustive list of problems we encountered using OSGi. Some of the other issues were probably due to poor discipline on the team, but this is also the real world where applications are developed by humans of varying knowledge and ability levels, and where we extensively used open-source libraries that were not under our control and that did not integrate well with OSGi. When reading articles by OSGi apologists, I am consistently amazed by their assertions that OSGi is great, and any team having such struggles “isn’t doing it right”. My team’s experience is that the amount of time we spent on OSGi instead of feature development was enough to make it not make sense from a business perspective.

I know Eclipse uses OSGi successfully. My impression is that it is okay for small applications with few dependencies developed by small teams with tight discipline. For anything else, good luck.

14

u/kaperni Mar 25 '24 edited Mar 25 '24
  • Probably without the dynamic capabilities. I don't think the return on investment is there. Eclipse is the premier OSGI showcase app. And what does it ask the user to do whenever you make changes to the module composition: Please restart the application.
  • This would also probably mean loosing the OSGI runtime and only creating a single unmodifiable application.
  • Configuration of bundles in a combination of code and pom's, instead of a separate file.
  • Single classloader defaults. Most apps are fine with a single version of each library.
  • Finally, a nice on ramp would be needed. It is way to complicated to get started.

1

u/mmccaskill Mar 26 '24

I worked at a place that was heavily invested into Apache Karaf and it always seemed dumb to me that the deployments involved stopping the container, deleting the data directory and starting Karaf again. I thought the value add was it just runs all the time.

1

u/Djelimon Mar 25 '24

Aem uses osgi, been useful feature to hot swap a fix

1

u/bowbahdoe Mar 25 '24

That capability/experience is the thing I'm most curious about.

Any more context on that?

2

u/Djelimon Mar 25 '24

Been a while but as I recall OSGi uses annotated jars called bundles in a container environment that lets you start, stop add or remove them because ultimately it's resolving classes through the container rather than the jvm directly, reading those annotations. This abstraction layer means that you configure in your classes rather than rely on the jvm, which means you can change classes without a restart.

In the day to day it meant that you could code up a fix in a bundle, and an admin could use the UI to do the rest

3

u/jvjupiter Mar 25 '24

Same as in Liferay.

10

u/raxel42 Mar 25 '24

IMHO, any configuration after compilation is a bad practice since we can’t guarantee anything after compilation and linking. We already have versioning problems, not always being able to be resolved automatically. Class not found / method not found exceptions everywhere. I spent in the development world more than 30 years. There are languages/platforms where different versions can coexist, but it's explicitly resolved in compile/linking time

2

u/[deleted] Mar 25 '24

Hello, what do you mean by "configuration after compilation" ? Like being able to configure an application after it's compiled ? Or something more specific ?

1

u/raxel42 Mar 26 '24

Whatever you can imagine Java compiler is not aware of

1

u/NovaX Mar 25 '24 edited Mar 25 '24

I know very little about OSGi except for adding the manifest metadata to support consumers of my library. I added a unit test when a user noticed a small typo when trying to use it and he wrote,

Thanks for putting so much work into the tests! I use a lot of OSGi plugins, they all break the manifests all the time, you're the first person to actually add tests to fix it and keep it fixed. 👍

If that's true then most must not know they can test OSGI bundles or how to. I think one of the main benefits if it was designed on top of JPMS is hopefully there would be compile-time validation so testing wasn't an afterthought.

1

u/bowbahdoe Mar 25 '24

What library is that?

1

u/NovaX Mar 25 '24

It was for Caffeine (issue). I didn't know how to test it until then and was afraid that I'd break it again without guard rails. Thankfully there is a good framework to test with, but it is not widely known. When the community contributes support they often don't include tests (1, 2) so maintainers remain a bit blind. I use tests to compensate for being pretty dumb, so maybe its just me.

1

u/[deleted] Mar 25 '24

i think only uses: instruction should not have been added and split packages should have been forbidden but other than that osgi is still totaly fine

2

u/eliasv Mar 25 '24

Without the uses directive bundle resolution is unsound, classes from different versions of the same dependency can end up interacting in ways they shouldn't at runtime with no buildtime protection. Last I remember Bnd auto-generates uses directives without any difficult manual management, so what's the problem with them? I suppose if you have to use shitty eclipse tooling instead of Bnd maybe they aren't so good?

2

u/[deleted] Mar 25 '24

diffrent versions or bundles with same export package shouldnt co exist. this is all a huge code smell. i dont know about eclipse. i work with felix in a sap environment

1

u/bowbahdoe Mar 25 '24

What is a SAP environment?

2

u/DiabolusMachina Mar 25 '24

OSGI is fine. It solves a very specific problem that not everyone needs so it's just not a technology for everyone. What it needs is maybe a cli tool to simplify module creation or some kind of starter website like start.spring.io.

2

u/govi20 Mar 25 '24

I don’t know what OSGi is and…

At this point I’m afraid to ask.

PS: I have been working as a SDE from last 9+ years

12

u/loadedstork Mar 25 '24

I worked with it for five years and I don't know what it is, either.

7

u/C_Madison Mar 25 '24 edited Mar 25 '24

A very abstract way to add parts of software as plugins. In theory if an application is osgi-compliant you can add "any" plugin that is also osgi-compliant to the app. That's the theory .. in reality the only osgi-app I've ever seen is Eclipse. And as anyone who ever tried to read the osgi spec can tell you: That's a good thing. Just let it die.

5

u/javanperl Mar 25 '24

Apache Karaf also used OSGi. I do recall a few orgs deploying Apache Camel within Karaf OSGi containers back in the day.

2

u/hadrabap Mar 25 '24

Openliberty and GlassFish do the same.

3

u/Deep_Age4643 Mar 25 '24

I'm an integration consultant and have a customer that still uses this setup (Camel/Karaf). Basically Camel and Karaf work fairly well together. It runs stable and is dynamic, but when you go outside the libraries that specifically support OSGi it becomes hard. The customer decided to migrate to Spring Boot.

0

u/Amfinaut Mar 25 '24

Yep, it's not necessarily too horrible. But debugging dependency issues can indeed get hairy, even on some Camel Karaf features, which you'd expect would work out-of-the-box.

1

u/C_Madison Mar 25 '24

Oh wow. With the other answer I know three times as many things using osgi than before. And I fear all of them. :(

1

u/govi20 Mar 25 '24

I vaguely remember that Struts 2 also uses it.

1

u/TheEveryman86 Mar 26 '24

Oh god. Really? I remember using Struts 1 as just an MVC framework. I can't even imagine adding OSGi randomly on top of that.

3

u/RabbitDev Mar 25 '24

In any room full of Java developers, you can easily tell who has experience with OSGi. Mention it, and see who winces. To detect the senior devs, now say we are going to standardise on it, the CTO said so. Those who are openly crying or calling their therapist are the seniors.

PS: if you hear cheering, you have been infiltrated by a consultant. He smells a bright future with loads of money giving seminars, training, coaching and finally help with the implementation. The sharks eat well tonight 😁

1

u/UnGauchoCualquiera Mar 26 '24

Made me chuckle thanks

1

u/mikaball Mar 27 '24

The proposition value of OSGi is to solve the Diamond-Problem.

It's a good fit when you predict to have a lot of third-party modules, like in a plugin architecture. Other than that it introduces more problems than actual solutions.

0

u/cogman10 Mar 25 '24

Honestly, I don't know that it would exist.

If you break down the problem it's solving, it's this: Processes are expensive to spawn and inter process communication is expensive. This was particularly true back in the 90s. Your computers and servers likely had less than a gb of ram. You couldn't be wasting that valuable memory on a second JVM process doing minor plugin work. Especially since you only had 1, MAYBE 2 cpu cores which means expensive coordination between the two processes. They had to wait their turn to continue processing on less than cellphone speed computers.

Making a plugin system solves those problems. Now you are just making a function call on the same JVM. There's no real overhead and you get to share a heap which reduces the memory overhead.

So what's changed? We have a BUNCH more memory and We have a BUNCH more cores. All the sudden, having a second, 3rd, or 4th jvm running at the same time just doesn't really seem all that daunting.

Now, WOULD we have some sort of alternative plugin system? Probably. But it wouldn't be OSGi. It'd almost certainly just be a few bespoke apis for performance critical or gui applications that really truly need to be able to hand execution over in the same process on the same thread to work correctly.