Redesign the LibClassLoader to load connector and its dependencies #2317
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR reverts the following PRs and add a new implementation for the LibClassLoader.
Improvement commits
Earlier design
![Screenshot 2025-01-30 at 22 33 35](https://private-user-images.githubusercontent.com/17047910/408220252-f2babb9a-ec41-4b9e-afd1-ea21fa319ca8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDg3MDUsIm5iZiI6MTczOTAwODQwNSwicGF0aCI6Ii8xNzA0NzkxMC80MDgyMjAyNTItZjJiYWJiOWEtZWM0MS00YjllLWFmZDEtZWEyMWZhMzE5Y2E4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA5NTMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4NmMxY2E4NTQxNTY1ZmU4OGVhNTM5NTFmOTRmNTMyMjg3ZTUzOTRiNTRhNTcwZDY1ZTgyZmM2NjZhYTBlYjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.FsIEaASp8CzcKXQJXKaK_4cyqxbpfs5oy4kQdTDdyTw)
As per the above design, one class loader is used per capp to load the class mediators, connectors and its dependencies. But this raises an issue where two connectors or its dependencies can have the same class name and package name which can cause a confusion when loading a specific class.
Hence the following design is proposed.
New design
![Screenshot 2025-01-30 at 22 34 01](https://private-user-images.githubusercontent.com/17047910/408220378-aba1cc85-0d91-4e19-8ae6-59b6fc69af62.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMDg3MDUsIm5iZiI6MTczOTAwODQwNSwicGF0aCI6Ii8xNzA0NzkxMC80MDgyMjAzNzgtYWJhMWNjODUtMGQ5MS00ZTE5LThhZTYtNTliNmZjNjlhZjYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA5NTMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjYmQ4N2RkMjZkOGI4MDQyMjM3MjM2YzAwZjJkZDFlYzVhMDZkYmU4ZjEwNjBjYWMxNzEwZGYyYTJhNTg5OTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0._FMuKQviRrk3fcEl9_yixNRYUsTIFTuSjoX0vMm-hHI)
Here a classloader is used for each connector. All the connector specific dependencies will be loaded to that particular class loader. This will prevent two connectors having similar classes getting added to the same classloader. The class mediators will be loaded to individual class loaders as before.