Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-3067: Upgrade ehcache to 3.3.1 #936

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Conversation

hanicz
Copy link
Contributor

@hanicz hanicz commented Oct 4, 2024

What changes were proposed in this pull request?

Upgrade ehcache from 2.x to 3.x

Currently with 2.x the CacheManager is a Singleton therefore every cache will be stored in the same CacheManager. Due to this caches with the same name will be created only once and different topologies are using the same cache. For example if a user authenticates in the sandbox topology the same user and password can be used for other topologies as well where ehcache is enabled and the cache name is the same. This could cause issues if the ldap configuration is different.

With Ehcache 3.x creating the CacheManager is our responsibility. Different topologies will have different configurations and caches even with the same name. Every topology that enables ehcache needs a different configuration file. The persistence attribute has to be unique.

How was this patch tested?

Unit tests and manually on local setup

}
}

private synchronized org.ehcache.Cache<Object, Object> createCache(String name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we synchronizing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is based on the 2.x CacheManager. In our use-case there is no race condition currently however future changes might introduce. The synchronized block doesn't slow Knox's start-up because there is no contention.

Copy link
Contributor

@pzampino pzampino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pzampino pzampino merged commit e73cb1a into apache:master Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants