Skip to content

OAK-12341 adding cache for service lookup - #3069

Open
pat-lego wants to merge 3 commits into
apache:trunkfrom
pat-lego:OAK-12341
Open

OAK-12341 adding cache for service lookup#3069
pat-lego wants to merge 3 commits into
apache:trunkfrom
pat-lego:OAK-12341

Conversation

@pat-lego

@pat-lego pat-lego commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The use of a service cache will prevent the need to perform service tracker requests lowering the chances of a blocking permission lookup

@anchela
anchela requested review from Amoratinos and anchela August 7, 2026 14:39
@anchela

anchela commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

hi @pat-lego , thanks a lot for the contribution. would you be able to also add one or multiple test cases that illustrates the issue? that's needed for us to merge the PR.

@Amoratinos Amoratinos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me 👍

Regarding the test it helps to understand the topic but I do not see too much value to add it to the test set as it will add more delay on test execution and not sure if it could be a bit flaky depending on the environment is executed. wdyt @anchela

@jsedding

Copy link
Copy Markdown
Contributor

For the stacktrace shared in the JIRA ticket, I believe it would be sufficient to change the isEnabled() method to the following. The rationale being that ServiceTracker.getServiceReference() reads the cached value from a volatile field, i.e. no synchronization overhead.

    boolean isEnabled() {
        return getServiceReference() != null;
    }

Now, the question is whether we see contention with different stack traces as well.

@jsedding

Copy link
Copy Markdown
Contributor

Note, PR #3072 proposes the alternative fix mentioned above.

@jsedding

Copy link
Copy Markdown
Contributor

I have closed #3072 because it looks like we need to speed up not only the isEnabled() code-path, but also the retrieval of references.

@pat-lego could you consider taking e7ab1d6 from my PR over? It would speed up the unit-tests. Feel free to adjust, based on @rishabhdaim 's comments over there.

@pat-lego

Copy link
Copy Markdown
Contributor Author

@jsedding added the test with 50 ms polling let me know if there are any other points on this if not perhaps we can move towards resolving this issue.

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.

4 participants