Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To be Reviewed By: August 20thSeptember 27, 2020


Authors: Udo Kohlmeyer

Status: Draft Draft | Discussion | Active | Dropped | Superseded

...

With the introduction of ClassLoader isolation into Geode a new problem is created. In many areas of the Geode codebase standard Java concepts are used to load resources that are on the Classpath or load services. In the ClassLoader isolated world the standard Java functions of `ServiceLoader.load` and `Class.getResourceAsStream` won't work anymore. This is due to the fact that we don't have a flat Classpath any more, where everything is on the same ClassLoader and easily accessible. There will now be multiple ClassLoaders and each is responsible for the files / classes / resources within it. In order for this functionality to work, the modular system described in the ClassLoader Isolation RFC now becomes responsible for the delegation of these commands to the underlying modular system to be fulfilled. Yet, we don't want to make the user / developer need to know HOW to complete this work, thus a level of abstraction is required. Another feature to consider is the ability to delegate to the existing standard JAVA concepts, like `ServiceLoader` and `getResourceAsStream`.

Anti-Goals

This proposal is not to create YA-ClassLoader abstraction, but merely provide an abstraction that would keep the current usage of ClassLoader features inside of the Geode codebase but at the same time enabling the capability to keep the same functionality in the ClassLoader Isolation world.

Solution

In order to have a more extendible architecture, a mechanism is required to extend the system's functionality by adding new implementations. The approach proposed is to introduce a ClassLoaderService. This ClassLoaderService is an interface that will expose the functional methods to the code, but it's implementation is provided / selected at startup / runtime. The ClassLoaderService will be accessible in the Geode system and delegate to the relevant implementation to resolve service implementations, load classes or load resources.

...