FINERACT-1022 - Update to org.ehcache
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
17cb620ec0
commit
ca97a37544
+11
-7
@@ -30,7 +30,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||
import org.springframework.cache.jcache.JCacheCacheManager;
|
||||
import org.springframework.cache.support.NoOpCacheManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -45,13 +45,13 @@ import org.springframework.stereotype.Component;
|
||||
@Component(value = "runtimeDelegatingCacheManager")
|
||||
public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
|
||||
private final EhCacheCacheManager ehcacheCacheManager;
|
||||
private final JCacheCacheManager jcacheCacheManager;
|
||||
private final CacheManager noOpCacheManager = new NoOpCacheManager();
|
||||
private CacheManager currentCacheManager;
|
||||
|
||||
@Autowired
|
||||
public RuntimeDelegatingCacheManager(final EhCacheCacheManager ehcacheCacheManager) {
|
||||
this.ehcacheCacheManager = ehcacheCacheManager;
|
||||
public RuntimeDelegatingCacheManager(final JCacheCacheManager jcacheCacheManager) {
|
||||
this.jcacheCacheManager = jcacheCacheManager;
|
||||
this.currentCacheManager = this.noOpCacheManager;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
public Collection<CacheData> retrieveAll() {
|
||||
|
||||
final boolean noCacheEnabled = this.currentCacheManager instanceof NoOpCacheManager;
|
||||
final boolean ehcacheEnabled = this.currentCacheManager instanceof EhCacheCacheManager;
|
||||
final boolean ehcacheEnabled = this.currentCacheManager instanceof JCacheCacheManager;
|
||||
|
||||
// final boolean distributedCacheEnabled = false;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
changes.put(CacheApiConstants.cacheTypeParameter, toCacheType.getValue());
|
||||
clearEhCache();
|
||||
}
|
||||
this.currentCacheManager = this.ehcacheCacheManager;
|
||||
this.currentCacheManager = this.jcacheCacheManager;
|
||||
break;
|
||||
case MULTI_NODE:
|
||||
if (!distributedCacheEnabled) {
|
||||
@@ -120,6 +120,10 @@ public class RuntimeDelegatingCacheManager implements CacheManager {
|
||||
}
|
||||
|
||||
private void clearEhCache() {
|
||||
this.ehcacheCacheManager.getCacheManager().clearAll();
|
||||
javax.cache.CacheManager cacheManager = this.jcacheCacheManager.getCacheManager();
|
||||
Iterable<String> cacheNames = cacheManager.getCacheNames();
|
||||
for (String cacheName: cacheNames) {
|
||||
cacheManager.getCache(cacheName).clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.monetary.domain;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import javax.annotation.PostConstruct;
|
||||
import net.sf.ehcache.util.FindBugsSuppressWarnings;
|
||||
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -40,7 +40,7 @@ public class MoneyHelper {
|
||||
|
||||
@PostConstruct
|
||||
// This is a hack, but fixing this is not trivial, because some @Entity domain classes use this helper
|
||||
@FindBugsSuppressWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
|
||||
@SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
|
||||
public void someFunction () {
|
||||
staticConfigurationDomainService = configurationDomainService;
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanproduct.data;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.sf.ehcache.util.FindBugsSuppressWarnings;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.common.AccountingRuleType;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
@@ -1160,12 +1160,12 @@ public class LoanProductData implements Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
public Boolean isCompoundingToBePostedAsTransaction() {
|
||||
return isInterestRecalculationEnabled() ? this.interestRecalculationData.isCompoundingToBePostedAsTransaction() : null;
|
||||
}
|
||||
|
||||
@FindBugsSuppressWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
|
||||
public Boolean allowCompoundingOnEod() {
|
||||
return isInterestRecalculationEnabled() ? this.interestRecalculationData.allowCompoundingOnEod() : null;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,10 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
|
||||
|
||||
<bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
|
||||
<bean id="ehcacheManager" class="org.springframework.cache.jcache.JCacheCacheManager"
|
||||
p:cacheManager-ref="ehcacheInstance" />
|
||||
|
||||
<bean id="ehcacheInstance"
|
||||
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
|
||||
p:configLocation="classpath:/META-INF/spring/ehcache.xml" p:shared="true" />
|
||||
class="org.springframework.cache.jcache.JCacheManagerFactoryBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -21,8 +21,9 @@
|
||||
-->
|
||||
|
||||
|
||||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd">
|
||||
<config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.ehcache.org/v3'
|
||||
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.7.xsd">
|
||||
|
||||
<defaultCache eternal="true" maxEntriesLocalHeap="100"
|
||||
overflowToDisk="false" />
|
||||
|
||||
@@ -52,4 +53,4 @@
|
||||
overflowToDisk="false" timeToIdleSeconds="7200" />
|
||||
<cache name="tfConfig" maxEntriesLocalHeap="10000" eternal="true"
|
||||
overflowToDisk="false" />
|
||||
</ehcache>
|
||||
</config>
|
||||
Reference in New Issue
Block a user