ehcache / ehcache-jcache

The Ehcache 2.x implementation of JSR107 (JCACHE)
Other
91 stars 48 forks source link

fixed error when shutting down provider #44

Closed zdanek closed 9 years ago

zdanek commented 9 years ago

fixed error when shutting down provider with manager not found in managers collection

terracotta-org commented 9 years ago

Can one of the admins verify this patch?

alexsnaps commented 9 years ago

@zdanek I wonder if this shouldn't throw an IllegalArgumentException or something... Can you share you ended up hitting that problem?

zdanek commented 9 years ago

As simple as that:

    Configuration configuration = new Configuration();
    CacheManager manager = new CacheManager(configuration);
    JCacheCachingProvider provider = new JCacheCachingProvider();
    URI uri = null;
    Properties props = new Properties();
    JCacheManager jCacheManager = new JCacheManager(provider, manager, uri, props);
    jCacheManager.close();

I KNOW that it should be done otherwise, with Caching.getCachingProvider().getCacheManager()

But currently I'm forced to create a runtime configuration and that's why I must instantiate my own CacheManager and then JCacheManager. I'm not using JCacheCachingProvider at all.

Current implementation of JSR107 for EhCache doesn't allow passing a runtime config for CacheManager. Only XML is allowed.

ljacomet commented 9 years ago

test this please

ljacomet commented 9 years ago

test this please

alexsnaps commented 9 years ago

Merged