I want to create an Ignite node with a programmatic configuration. A javax.cache.CacheManager object is required for the application.
I know that I can start an Ignite node with the following code:
//with XML configuration
Ignition.start("path-to-ignite-config-xml");
//with programmatic configuration
Ignition.start(cfg)
//with xml-config with the JCache-API
Caching.getCachingProvider().getCacheManager(uriToXML, classloader);
The first two method calls got an Ignite object as a return value.
The last one got a CacheManager object as a return value.
But I would need something like this:
Caching.getCachingProvider().getCacheManager(IgniteConfiguration cfg);
// or this:
Ignition.start(IgniteConfiguration cfg).getCacheManager();
There's a method org.apache.ignite.cache.CachingProvider.findManager(Ignite) which has got the return type javax.cache.CacheManager (which is what I want)
but the return value is always null.
Is there a way to get a javax.cache.CacheManager object without XML config?
I worked around the issue in my code by ditching
CachingProviderand writing my own implementation of thejavax.cache.CacheManagerinterface.I am creating an
Igniteinstance in the constructor of theCacheManagerimplementation and forwarding all the calls to it.IgniteCacheis already implementingjavax.cache.Cache, so no issues there.It is not strictly JCache, but it is close enough for my purposes.