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

Bypass JSR107 layer when creating cache cause it to be not found #2494

Closed
henri-tremblay opened this issue Sep 25, 2018 · 3 comments
Closed
Assignees
Labels

Comments

@henri-tremblay
Copy link
Contributor

If a cache is created directory on the wrapped Ehcache CacheManager, the JSR107 won' see it. See this code:

    @Test
    public void test() {
        CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
        org.ehcache.CacheManager ecm = cacheManager.unwrap(org.ehcache.CacheManager.class);
        ecm.createCache("foo", CacheConfigurationBuilder.newCacheConfigurationBuilder(Integer.class, String.class, ResourcePoolsBuilder.heap(1)));

        Cache<Integer, String> cache = cacheManager.getCache("foo", Integer.class, String.class);
        assertThat(cache).isNotNull(); // fails
    }

However, add a cacheManager.getCacheNames() before calling getCache repairs it since it causes a cache refresh.

I think it should work or at least be coherent.

@chrisdennis
Copy link
Member

There has been work in this area recently... I think this might be fixed. This should get reassessed in-house and closed if it really has been fixed.

@nnares
Copy link
Contributor

nnares commented Dec 20, 2022

@chrisdennis, I have validated the mentioned use case and found that issue is still there (sample JUnit is still failing)

The above code is logically correct, as the cache is been created post unwrap() method call, So it should not be visible to javaxCacheManager.
Current implement allows visibility of such new cache which has been created post unwrap() method call after a cache refresh, which can be achieved by calling - cacheManager.getCacheNames()
My stand here is logged issue is there, but the mentioned behavior is logically correct.
If we still want a fix for this, we need to add cache refresh logic there inside of .getCache() method

Adding
Referred api doc for unwrap() method, its simply saying - Returns: an instance of the underlying concrete CacheManager
which is working fine - If the underlying CacheManager is having a cache it is accessible to unwrapedCacehManager as well

@nnares nnares pinned this issue Dec 20, 2022
@AbfrmBlr AbfrmBlr unpinned this issue Jan 4, 2023
@nnares
Copy link
Contributor

nnares commented May 18, 2023

Fixed(daggy) in #3117, #3119

@nnares nnares closed this as completed May 18, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Bug Prioritization May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants