![JAR search and dependency download from the Maven repository](/logo.png)
yakworks.spring.hazelcast.HazelCacheManager.groovy Maven / Gradle / Ivy
/*
* Copyright 2008-2023 Yak.Works - Licensed under the Apache License, Version 2.0 (the "License")
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
package yakworks.spring.hazelcast
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.springframework.cache.Cache
import org.springframework.cache.CacheManager
import com.hazelcast.core.HazelcastInstance
import com.hazelcast.map.IMap
import com.hazelcast.spring.cache.HazelcastCacheManager
import yakworks.util.ReflectionUtils
/**
* Spring-related {@link CacheManager} implementation for Hazelcast.
*/
@Slf4j
@SuppressWarnings(['WeakerAccess', 'ExplicitHashMapInstantiation'])
@CompileStatic
public class HazelCacheManager extends HazelcastCacheManager {
private final ConcurrentMap caches = new ConcurrentHashMap();
/**
* Default cache tryLock wait timeout. Apply to all caches.
*/
long defaultLockTimeout;
/**
* Holds cache specific tryLock wait timeout. Override defaultLockTimeout for specified caches.
*/
Map lockTimeoutMap = new HashMap();
public HazelCacheManager() {}
public HazelCacheManager(HazelcastInstance hazelcastInstance) {
super(hazelcastInstance);
}
//complete replacment since we do so much work. now way to extend it since we replace with HazelCache.
//we add the lockTimeout
@Override
public Cache getCache(String name) {
log.debug "************** getCache name $name"
Cache cache = caches.get(name);
if (cache == null) {
IMap
© 2015 - 2025 Weber Informatics LLC | Privacy Policy