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-2788 - Implementing EmptyVerifier and Cleaning background thread #620
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y would succeed on slower machines too
zeroflag
requested changes
Aug 19, 2022
...src/main/java/org/apache/knox/gateway/session/control/InMemoryConcurrentSessionVerifier.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/knox/gateway/services/factory/ConcurrentSessionVerifierFactory.java
Show resolved
Hide resolved
smolnar82
approved these changes
Aug 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
smolnar82
changed the title
Knox 2788 - Implementing EmptyVerifier and Cleaning background thread
KNOX-2788 - Implementing EmptyVerifier and Cleaning background thread
Aug 22, 2022
zeroflag
approved these changes
Aug 22, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
I added an empty implementation of the
ConcurrentSessionVerifier
(EmptyConcurrentSessionVerifier
), now it is the default so users do not waste resources when they forget to configure the verifier. If they need theInMemoryConcurrentSessionVerifier
implementation they need to configure it and pay attention to configure at least one user in at least one of the groups.For example:
I also added a background thread which cleans out the expired tokens from the
InMemoryConcurrentSessionVerifier
to save some resources. The default cleaning time is 30 minutes, but it can be configured by adding how many minutes we want the cleaning period to be:How was this patch tested?
I have written unit tests for the
ConcurrentSessionVeriferFactory
to test that the factory gives back the right implementation for the right configuration.I also added a unit test into
InMemoryConcurrentSessionVerifierTest
to test the background thread removing the expired tokens.I also added stress tests to
InMemoryConcurrentSessionVerifierTest
to test whether the locking is working and theInMemoryConcurrentSessionVerifier
is truly thread safe.I also tested the behaviour with the following configurations: