Search in sources :

Example 1 with BasicCacheHandle

use of org.commonjava.indy.subsys.infinispan.BasicCacheHandle in project indy by Commonjava.

the class MetadataCacheProducer method registerTransformer.

private void registerTransformer(BasicCacheHandle handler) {
    // for embedded mode
    if (handler instanceof CacheHandle) {
        ((CacheHandle<MetadataKey, MetadataKey>) handler).executeCache(cache -> {
            SearchManagerImplementor searchManager = (SearchManagerImplementor) Search.getSearchManager(cache);
            searchManager.registerKeyTransformer(MetadataKey.class, MetadataKeyTransformer.class);
            return null;
        });
    }
    if (handler.getCache() instanceof RemoteCache) {
        ((RemoteCache) handler.getCache()).addClientListener(cacheListener);
    } else {
        ((Cache) handler.getCache()).addListener(cacheListener);
    }
}
Also used : SearchManagerImplementor(org.infinispan.query.spi.SearchManagerImplementor) BasicCacheHandle(org.commonjava.indy.subsys.infinispan.BasicCacheHandle) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) RemoteCache(org.infinispan.client.hotrod.RemoteCache) Cache(org.infinispan.Cache) RemoteCache(org.infinispan.client.hotrod.RemoteCache)

Aggregations

BasicCacheHandle (org.commonjava.indy.subsys.infinispan.BasicCacheHandle)1 CacheHandle (org.commonjava.indy.subsys.infinispan.CacheHandle)1 Cache (org.infinispan.Cache)1 RemoteCache (org.infinispan.client.hotrod.RemoteCache)1 SearchManagerImplementor (org.infinispan.query.spi.SearchManagerImplementor)1