adaptive-caching-framework
Changes
framework/autonomicmanager/pom.xml 27(+0 -27)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/Analyzer.java 15(+4 -11)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/CacheDecider.java 4(+1 -3)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/FlowchartWorkFlow.java 15(+9 -6)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/stats/CacheabilityPatternDecider.java 8(+5 -3)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/Processer.java 7(+0 -7)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/AdaptiveMethodCacher.java 86(+86 -0)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/extensions/provided/MyMethodCacher.java 168(+0 -168)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/extensions/provided/Tunnel.java 161(+0 -161)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/generic/KeyGenerator.java 42(+0 -42)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/generic/ParamsBasedKeyGenerator.java 31(+0 -31)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/generic/SimpleKey.java 68(+0 -68)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/Key.java 5(+0 -5)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/MethodCacher.java 8(+5 -3)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/UpdateMethodCacher.java 174(+0 -174)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/AbstractCacheManager.java 23(+0 -23)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCache.java 21(+0 -21)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCacheManager.java 22(+0 -22)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCache.java 21(+0 -21)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCacheManager.java 20(+0 -20)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerFactoryBean.java 23(+0 -23)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerUtils.java 19(+0 -19)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCache.java 19(+0 -19)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCacheManager.java 20(+0 -20)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/Cache.java 24(+0 -24)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/CacheManager.java 23(+0 -23)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/AbstractValueAdaptingCache.java 19(+0 -19)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/CompositeCacheManager.java 20(+0 -20)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NoOpCacheManager.java 20(+0 -20)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NullValue.java 19(+0 -19)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleCacheManager.java 18(+0 -18)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleValueWrapper.java 18(+0 -18)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/util/threads/NamedThreads.java 9(+0 -9)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/aspects/TracerAspect.java 69(+8 -61)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/usersession/AnonymousUserGetter.java 3(+0 -3)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/cache/triggers/MyJedisMonitor.java 2(+1 -1)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/providers/AsyncFileRepository.java 7(+4 -3)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/providers/ConsoleRepository.java 3(+2 -1)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/providers/MemoryRepository.java 3(+2 -1)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/providers/MongoRepository.java 3(+2 -1)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/providers/RedisRepository.java 3(+2 -1)
framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/RepositoryFactory.java 3(+2 -1)
Details
framework/autonomicmanager/pom.xml 27(+0 -27)
diff --git a/framework/autonomicmanager/pom.xml b/framework/autonomicmanager/pom.xml
index 7f56f08..348f979 100644
--- a/framework/autonomicmanager/pom.xml
+++ b/framework/autonomicmanager/pom.xml
@@ -81,12 +81,6 @@
<version>2.5.3</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>io.fastjson</groupId>-->
- <!--<artifactId>boon</artifactId>-->
- <!--<version>0.34</version>-->
- <!--</dependency>-->
-
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
@@ -105,11 +99,6 @@
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>org.infinispan</groupId>-->
- <!--<artifactId>infinispan-core</artifactId>-->
- <!--<version>8.2.1.Final</version>-->
- <!--</dependency>-->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
@@ -120,22 +109,6 @@
<artifactId>ehcache</artifactId>
<version>2.10.3</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>backport-util-concurrent</groupId>-->
- <!--<artifactId>backport-util-concurrent</artifactId>-->
- <!--<version>3.1</version>-->
- <!--</dependency>-->
-
- <!--<dependency>-->
- <!--<groupId>javax.model</groupId>-->
- <!--<artifactId>model-api</artifactId>-->
- <!--<version>1.0.0</version>-->
- <!--</dependency>-->
- <!--<dependency>-->
- <!--<groupId>com.google.code.simple-spring-memcached</groupId>-->
- <!--<artifactId>xmemcached-provider</artifactId>-->
- <!--<version>3.6.0</version>-->
- <!--</dependency>-->
<dependency>
<groupId>redis.clients</groupId>
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/Analyzer.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/Analyzer.java
index ce1af06..569ed07 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/Analyzer.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/Analyzer.java
@@ -2,7 +2,6 @@ package br.ufrgs.inf.prosoft.adaptivecaching.analysis;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.FlowchartWorkFlow;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.model.MethodEntry;
-import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.stats.CacheabilityPatternDecider;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.guava.GuavaCache;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.guava.GuavaCacheManager;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -16,7 +15,7 @@ import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.LogT
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheInfo;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheMonitor;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.vendors.guava.GuavaMonitor;
-import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.MongoRepository;
+import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.providers.MongoRepository;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.Repository;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
@@ -59,8 +58,8 @@ public class Analyzer implements Runnable {
List all = dataSource.findAll();
-// if(all.size() < 300)
-// return;
+ //here we can check whether there are enough logs to process, such as
+ //if(all.size() < 300) return;
Set<MethodEntry> process = analyzeAndReturn(all);
@@ -74,11 +73,6 @@ public class Analyzer implements Runnable {
TracerAspect.cacheableMethods = process;
TracerAspect.cacheableMethodKeys = process.stream().map(MethodEntry::getMethodInfoKey).collect(Collectors.toSet());
-// TracerAspect.cacheableMethodKeys = new HashSet<>();
-// for (MethodEntry me : process){
-// TracerAspect.cacheableMethodKeys.add(me.getMethodInfoKey());
-// }
-
String methods = "";
for (MethodEntry me : process) methods = methods.concat(me.getMethodInfo().getSignature() + ",");
@@ -99,8 +93,7 @@ public class Analyzer implements Runnable {
// if(logList.size() < 500000)
// return;
- CacheabilityPatternDecider decider = new CacheabilityPatternDecider(logList.size());
- FlowchartWorkFlow workflow = new FlowchartWorkFlow(decider, cacheInfo, logList);
+ FlowchartWorkFlow workflow = new FlowchartWorkFlow(cacheInfo, logList);
Set<MethodEntry> process = workflow.filterCacheableMethods(adaptiveConfig.expiryInterval());
logger.info(process.size() + " cacheable methods identified.");
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/CacheDecider.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/CacheDecider.java
index 37bfd7c..26f1882 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/CacheDecider.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/CacheDecider.java
@@ -1,13 +1,11 @@
package br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision;
-import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.FlowchartWorkFlow;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.model.MethodStats;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.MethodInfo;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheInfo;
public interface CacheDecider {
- //TODO remover flowchartprocesser
- boolean isCacheable(CacheInfo cacheInfo, MethodInfo methodInfo, MethodStats methodStats, FlowchartWorkFlow processer);
+ boolean isCacheable(CacheInfo cacheInfo, MethodInfo methodInfo, MethodStats methodStats);
}
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/FlowchartWorkFlow.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/FlowchartWorkFlow.java
index 1ad22b4..7021d39 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/FlowchartWorkFlow.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/FlowchartWorkFlow.java
@@ -1,10 +1,10 @@
package br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.CacheDecider;
-import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.Processer;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.model.MethodEntry;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.model.MethodStats;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.stats.CacheabilityMetrics;
+import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.stats.CacheabilityPatternDecider;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.aspects.TracerAspect;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.LogTrace;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.MethodInfo;
@@ -18,10 +18,13 @@ import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
-public class FlowchartWorkFlow implements Processer {
+public class FlowchartWorkFlow {
private final long population;
protected HashMap<MethodInfo, MethodStats> methodsInfoMap;
@@ -41,8 +44,8 @@ public class FlowchartWorkFlow implements Processer {
private List<Double> shareabilities = new ArrayList<>();
private List<Long> frequencies = new ArrayList<>();
- public FlowchartWorkFlow(CacheDecider decider, CacheInfo cacheInfo, List<LogTrace> logList) {
- this.decider = decider;
+ public FlowchartWorkFlow(CacheInfo cacheInfo, List<LogTrace> logList) {
+ this.decider = new CacheabilityPatternDecider(logList.size(), this);
this.cacheInfo = cacheInfo;
this.methodsInfoMap = countOccurrences(logList);
this.population = logList.size();
@@ -82,7 +85,7 @@ public class FlowchartWorkFlow implements Processer {
logger.debug("Deciding if methods are cacheable...");
Set<MethodEntry> cacheableMethods = getMethodsInfoMap().keySet().stream()
- .filter(mi -> decider.isCacheable(cacheInfo, mi, getMethodsInfoMap().get(mi), this))
+ .filter(mi -> decider.isCacheable(cacheInfo, mi, getMethodsInfoMap().get(mi)))
.map(mi -> new MethodEntry(mi, getMethodsInfoMap().get(mi), System.currentTimeMillis() + expiryTime))
.collect(Collectors.toSet());
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/stats/CacheabilityPatternDecider.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/stats/CacheabilityPatternDecider.java
index aa2a491..a9af7fa 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/stats/CacheabilityPatternDecider.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/stats/CacheabilityPatternDecider.java
@@ -20,7 +20,10 @@ public class CacheabilityPatternDecider implements CacheDecider {
private final int population;
Logger logger = LoggerFactory.getLogger(CacheabilityPatternDecider.class);
- public CacheabilityPatternDecider(int size) {
+ FlowchartWorkFlow workflow;
+
+ public CacheabilityPatternDecider(int size, FlowchartWorkFlow workflow) {
+ this.workflow = workflow;
this.population = size;
}
@@ -28,11 +31,10 @@ public class CacheabilityPatternDecider implements CacheDecider {
* Flowchart definition
*
* @param methodStats
- * @param workflow
* @return
*/
@Override
- public boolean isCacheable(CacheInfo cacheInfo, MethodInfo methodInfo, MethodStats methodStats, FlowchartWorkFlow workflow) {
+ public boolean isCacheable(CacheInfo cacheInfo, MethodInfo methodInfo, MethodStats methodStats) {
//used more than once, in many parts of the reasoning
Optional<Boolean> isCacheSizeLarge = CacheabilityMetrics.isCacheSizeLarge(cacheInfo);
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/AdaptiveMethodCacher.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/AdaptiveMethodCacher.java
new file mode 100644
index 0000000..f712049
--- /dev/null
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/AdaptiveMethodCacher.java
@@ -0,0 +1,86 @@
+package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher;
+
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher.key.Key;
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.CacheManager;
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.ValueWrapper;
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.util.CacheManagerFactory;
+import br.ufrgs.inf.prosoft.adaptivecaching.configuration.annotation.types.CacheProviderType;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AdaptiveMethodCacher implements MethodCacher {
+
+ Logger logger = LoggerFactory.getLogger(AdaptiveMethodCacher.class);
+
+ //caching components
+ private CacheManager cacheManager;
+ private Cache cache;
+
+ public AdaptiveMethodCacher(CacheProviderType cacheProviderType, long expiryInterval) {
+ this.cacheManager = CacheManagerFactory.getCacheManager(cacheProviderType, expiryInterval);
+ this.cache = cacheManager.getCache("adaptivecaching");
+ }
+
+ @Override
+ public Object cache(Object key, ProceedingJoinPoint joinPoint) throws Throwable {
+
+ //already calculated
+ //final Key key = new Key(joinPoint);
+ //final SimpleKey key = (SimpleKey) joinPointKeyGenerator.generate(joinPoint);
+ ValueWrapper value = cache.get(key);
+
+ if (value != null) {
+ logger.debug(key + " with value: " + value.get() + " got from cachemanager");
+ return value.get();
+ }
+
+ Object result;
+ try {
+ result = joinPoint.proceed();
+ } catch (Exception ex) {
+ throw ex;
+ }
+
+ if (result != null) {
+ //todo maximize such decision
+ //maybe getcache info a lot can lead to a performance problem
+// if(cacheMonitor.getCacheInfo().getFreeSpace() > 0) {
+ cache.put(key, result);
+ logger.debug(key + " with value: " + result + " set in cachemanager");
+// }
+ }
+
+ return result;
+ }
+
+ @Override
+ public Object cache(ProceedingJoinPoint joinPoint) throws Throwable {
+ final Key key = new Key(joinPoint);
+ return cache(key, joinPoint);
+ }
+
+ @Override
+ public void preflush(JoinPoint point) {
+
+ }
+
+ @Override
+ public void postflush(JoinPoint point) {
+
+ }
+
+ public Cache getCache() {
+ return cache;
+ }
+
+ /**
+ * Clean cacheable methods expired.
+ */
+ private void clean() {
+ cache.clear();
+ logger.info("All cached values were removed.");
+ }
+}
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/Key.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/Key.java
index 5b26f03..ea372b4 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/Key.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/key/Key.java
@@ -78,11 +78,6 @@ public class Key {
return tgt;
}
-// @Override
-// public final String toString() {
-// return Mnemos.toText(this.method, this.arguments, true, false);
-// }
-
@Override
public String toString() {
return "Key{" +
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/MethodCacher.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/MethodCacher.java
index 12e3889..63226d2 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/MethodCacher.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/cacher/MethodCacher.java
@@ -4,9 +4,11 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
public interface MethodCacher {
- public Object cache(final ProceedingJoinPoint point) throws Throwable;
+ Object cache(final Object key, final ProceedingJoinPoint joinPoint) throws Throwable;
- public void preflush(final JoinPoint point);
+ Object cache(final ProceedingJoinPoint joinPoint) throws Throwable;
- public void postflush(final JoinPoint point);
+ void preflush(final JoinPoint joinPoint);
+
+ void postflush(final JoinPoint joinPoint);
}
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/AbstractCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/AbstractCacheManager.java
index 65b89cc..d2fb692 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/AbstractCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/AbstractCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -30,10 +14,6 @@ import java.util.concurrent.ConcurrentMap;
* Abstract base class implementing the common {@link CacheManager} methods.
* Useful for 'static' environments where the backing caches do not change.
*
- * @author Costin Leau
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 3.1
*/
public abstract class AbstractCacheManager implements CacheManager {
@@ -45,7 +25,6 @@ public abstract class AbstractCacheManager implements CacheManager {
* Initialize the static configuration of caches.
* <p>Triggered on startup through {@link #afterPropertiesSet()};
* can also be called to re-initialize at runtime.
- * @since 4.2.2
* @see #loadCaches()
*/
public void initializeCaches() {
@@ -111,7 +90,6 @@ public abstract class AbstractCacheManager implements CacheManager {
* the lazy creation of missing caches via {@link #getMissingCache(String)}.
* @param name the cache identifier (must not be {@code null})
* @return the associated Cache instance, or {@code null} if none found
- * @since 4.1
* @see #getCache(String)
* @see #getMissingCache(String)
*/
@@ -171,7 +149,6 @@ public abstract class AbstractCacheManager implements CacheManager {
* @param name the name of the cache to retrieve
* @return the missing cache or {@code null} if no such cache exists or could be
* created
- * @since 4.1
* @see #getCache(String)
*/
protected Cache getMissingCache(String name) {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCache.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCache.java
index ebd0332..b351080 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCache.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCache.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.caffeine;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support.AbstractValueAdaptingCache;
@@ -30,11 +14,6 @@ import java.util.function.Function;
* on top of a Caffeine {@link com.github.benmanes.caffeine.cache.Cache} instance.
* <p>
* <p>Requires Caffeine 2.1 or higher.
- *
- * @author Ben Manes
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 4.3
*/
@UsesJava8
public class CaffeineCache extends AbstractValueAdaptingCache {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCacheManager.java
index e1119e3..85110b3 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/caffeine/CaffeineCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.caffeine;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -44,12 +28,6 @@ import java.util.concurrent.ConcurrentMap;
* via the {@link #setCacheSpecification "cacheSpecification"} bean property.
* <p>
* <p>Requires Caffeine 2.1 or higher.
- *
- * @author Ben Manes
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @see CaffeineCache
- * @since 4.3
*/
public class CaffeineCacheManager implements CacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCache.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCache.java
index c247f62..b775f2f 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCache.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCache.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.ehcache;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -29,11 +13,6 @@ import java.util.concurrent.Callable;
/**
* {@link Cache} implementation on top of an {@link Ehcache} instance.
- *
- * @author Costin Leau
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 3.1
*/
public class EhCacheCache implements Cache {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCacheManager.java
index 0f43322..54649b9 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.ehcache;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.AbstractCacheManager;
@@ -28,10 +12,6 @@ import java.util.LinkedHashSet;
/**
* CacheManager backed by an EhCache {@link net.sf.ehcache.CacheManager}.
*
- * @author Costin Leau
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 3.1
*/
public class EhCacheCacheManager extends AbstractCacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerFactoryBean.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerFactoryBean.java
index 0f8d0dc..7370ce5 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerFactoryBean.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerFactoryBean.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.ehcache;
import net.sf.ehcache.CacheManager;
@@ -37,13 +21,6 @@ import org.springframework.core.io.Resource;
* also necessary for loading EhCache configuration from a non-default config location.
* <p>
* <p>Note: As of Spring 5.0, Spring's EhCache support requires EhCache 2.10 or higher.
- *
- * @author Juergen Hoeller
- * @author Dmitriy Kopylenko
- * @see #setConfigLocation
- * @see #setShared
- * @see net.sf.ehcache.CacheManager
- * @since 1.1.1
*/
public class EhCacheManagerFactoryBean {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerUtils.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerUtils.java
index 4fa166d..37694a4 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerUtils.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/ehcache/EhCacheManagerUtils.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2014 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.ehcache;
import net.sf.ehcache.CacheException;
@@ -35,9 +19,6 @@ import java.io.InputStream;
* code. For any advanced purposes, consider using {@link #parseConfiguration},
* customizing the configuration object, and then calling the
* {@link CacheManager#CacheManager(Configuration)} constructor.
- *
- * @author Juergen Hoeller
- * @since 4.1
*/
public abstract class EhCacheManagerUtils {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCache.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCache.java
index 3283b9a..80b934d 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCache.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCache.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.guava;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support.AbstractValueAdaptingCache;
@@ -30,9 +14,6 @@ import java.util.concurrent.ExecutionException;
* <p>
* <p>Requires Google Guava 12.0 or higher.
*
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 4.0
*/
public class GuavaCache extends AbstractValueAdaptingCache {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCacheManager.java
index 074873c..97e0864 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/extensions/guava/GuavaCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2014 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.guava;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -44,10 +28,6 @@ import java.util.concurrent.ConcurrentMap;
* <p>
* <p>Requires Google Guava 12.0 or higher.
*
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @see GuavaCache
- * @since 4.0
*/
public class GuavaCacheManager implements CacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/Cache.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/Cache.java
index 29932e3..503c525 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/Cache.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/Cache.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model;
import java.util.concurrent.Callable;
@@ -24,11 +8,6 @@ import java.util.concurrent.Callable;
* <b>Note:</b> Due to the generic use of caching, it is recommended that
* implementations allow storage of <tt>null</tt> values (for example to
* model methods that return {@code null}).
- *
- * @author Costin Leau
- * @author Juergen Hoeller
- * @author Stephane Nicoll
- * @since 3.1
*/
public interface Cache {
@@ -74,7 +53,6 @@ public interface Cache {
* @throws IllegalStateException if a model entry has been found
* but failed to match the specified type
* @see #get(Object)
- * @since 4.0
*/
<T> T get(Object key, Class<T> type);
@@ -131,7 +109,6 @@ public interface Cache {
* {@code null} itself), or also {@code null} if the model did not contain any
* mapping for that key prior to this call. Returning {@code null} is therefore
* an indicator that the given {@code value} has been associated with the key.
- * @since 4.1
*/
ValueWrapper putIfAbsent(Object key, Object value);
@@ -152,7 +129,6 @@ public interface Cache {
* Wrapper exception to be thrown from {@link #get(Object, Callable)}
* in case of the value loader callback failing with an exception.
*
- * @since 4.3
*/
@SuppressWarnings("serial")
class ValueRetrievalException extends RuntimeException {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/CacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/CacheManager.java
index e1fe8e9..129cee1 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/CacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/CacheManager.java
@@ -1,30 +1,7 @@
-/*
- * Copyright 2002-2014 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model;
import java.util.Collection;
-/**
- * Spring's central model manager SPI.
- * Allows for retrieving named {@link Cache} regions.
- *
- * @author Costin Leau
- * @since 3.1
- */
public interface CacheManager {
/**
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/AbstractValueAdaptingCache.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/AbstractValueAdaptingCache.java
index 40454fc..5bc5652 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/AbstractValueAdaptingCache.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/AbstractValueAdaptingCache.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -27,9 +11,6 @@ import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.ValueWrapper;
* <p>Transparently replaces given {@code null} user values with an internal
* {@link NullValue#INSTANCE}, if configured to support {@code null} values
* (as indicated by {@link #isAllowNullValues()}.
- *
- * @author Juergen Hoeller
- * @since 4.2.2
*/
public abstract class AbstractValueAdaptingCache implements Cache {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/CompositeCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/CompositeCacheManager.java
index 11b694d..565f9f8 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/CompositeCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/CompositeCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2014 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -37,10 +21,6 @@ import java.util.*;
* of named caches once requested; check out the specific configuration details
* for a 'static' mode with fixed model names, if available.
*
- * @author Costin Leau
- * @author Juergen Hoeller
- * @see #setFallbackToNoOpCache
- * @since 3.1
*/
public class CompositeCacheManager implements CacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NoOpCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NoOpCacheManager.java
index fba6e88..ffb34f9 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NoOpCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NoOpCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
@@ -36,10 +20,6 @@ import java.util.concurrent.ConcurrentMap;
* <p>
* <p>Will simply accept any items into the model not actually storing them.
*
- * @author Costin Leau
- * @author Stephane Nicoll
- * @see CompositeCacheManager
- * @since 3.1
*/
public class NoOpCacheManager implements CacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NullValue.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NullValue.java
index 975bcb5..c012f03 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NullValue.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/NullValue.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
import java.io.Serializable;
@@ -22,9 +6,6 @@ import java.io.Serializable;
* Simple serializable class that serves as a {@code null} replacement
* for model stores which otherwise do not support {@code null} values.
*
- * @author Juergen Hoeller
- * @see br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support.AbstractValueAdaptingCache
- * @since 4.2.2
*/
public final class NullValue implements Serializable {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleCacheManager.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleCacheManager.java
index 0780462..2882bfc 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleCacheManager.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleCacheManager.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.AbstractCacheManager;
@@ -25,8 +9,6 @@ import java.util.Collection;
* Simple model manager working against a given collection of caches.
* Useful for testing or simple caching declarations.
*
- * @author Costin Leau
- * @since 3.1
*/
public class SimpleCacheManager extends AbstractCacheManager {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleValueWrapper.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleValueWrapper.java
index 5cd264a..c1776c9 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleValueWrapper.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/model/support/SimpleValueWrapper.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2002-2012 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.support;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.ValueWrapper;
@@ -22,8 +6,6 @@ import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.ValueWrapper;
* Straightforward implementation of {@link },
* simply holding the value as given at construction and returning it from {@link #get()}.
*
- * @author Costin Leau
- * @since 3.1
*/
public class SimpleValueWrapper implements ValueWrapper {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/util/threads/NamedThreads.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/util/threads/NamedThreads.java
index c2dc6f8..ac28892 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/util/threads/NamedThreads.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/cachemanager/util/threads/NamedThreads.java
@@ -5,15 +5,6 @@ import org.slf4j.LoggerFactory;
import java.util.concurrent.ThreadFactory;
-/**
- * <p>This custom class is used instead of a default ThreadFactory in order
- * to name scheduled threads correctly on construction.
- *
- * @author Yegor Bugayenko (yegor@tpc2.com)
- * @version $Id$
- * @since 0.7.17
- */
-@SuppressWarnings("PMD.DoNotUseThreads")
public class NamedThreads implements ThreadFactory {
/**
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/aspects/TracerAspect.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/aspects/TracerAspect.java
index a5f1f26..368ba9f 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/aspects/TracerAspect.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/aspects/TracerAspect.java
@@ -2,11 +2,8 @@ package br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.aspects;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.Analyzer;
import br.ufrgs.inf.prosoft.adaptivecaching.analysis.decision.flowchart.model.MethodEntry;
+import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher.AdaptiveMethodCacher;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher.key.Key;
-import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
-import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.CacheManager;
-import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.ValueWrapper;
-import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.util.CacheManagerFactory;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.util.threads.NamedThreads;
import br.ufrgs.inf.prosoft.adaptivecaching.configuration.annotation.AdaptiveCaching;
import br.ufrgs.inf.prosoft.adaptivecaching.configuration.annotation.ComponentScan;
@@ -19,7 +16,7 @@ import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.usersession.U
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.usersession.UserGetterFactory;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheMonitor;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheMonitorFactory;
-import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.MongoRepository;
+import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.providers.MongoRepository;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.Repository;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.RepositoryFactory;
import com.mongodb.MongoClient;
@@ -95,9 +92,7 @@ public class TracerAspect {
private String[] allowed;
private String[] notAllowed;
- //caching components
- private CacheManager cacheManager;
- private Cache cache;
+ private AdaptiveMethodCacher cacher;
private CacheMonitor cacheMonitor;
//adaptive caching configurations
@@ -184,9 +179,8 @@ public class TracerAspect {
} else tracerEnabled = false;
- this.cacheManager = CacheManagerFactory.getCacheManager(cachingConfig.cacheProvider(), cachingConfig.expiryInterval());
- this.cache = cacheManager.getCache("adaptivecaching");
- this.cacheMonitor = CacheMonitorFactory.getCacheMonitor(this.cache, cachingConfig.cacheProvider());
+ this.cacher = new AdaptiveMethodCacher(cachingConfig.cacheProvider(), cachingConfig.expiryInterval());
+ this.cacheMonitor = CacheMonitorFactory.getCacheMonitor(this.cacher.getCache(), cachingConfig.cacheProvider());
//TODO load another options from @AdaptiveCaching
@@ -241,7 +235,7 @@ public class TracerAspect {
//see if a method is being caught
//traceSpecificMethod(joinPoint);
- if(!isAllowed(joinPoint))
+ if (!isAllowed(joinPoint))
return joinPoint.proceed();
//generate a hash of the method that will be used as: key to cache and compare if the method is allowed or not
@@ -249,10 +243,8 @@ public class TracerAspect {
//when method is already cached and obtained from it, no trace will be generated
//System.out.println(key + "generated to " + joinPoint.getSignature().toLongString());
- if(cacheableMethodKeys.contains(key)) {
-
- //System.out.println(key + "is a cacheable method");
- return cache(key, joinPoint);
+ if (cacheableMethodKeys.contains(key)) {
+ this.cacher.cache(key, joinPoint);
//caching methods
// for (MethodEntry methodAnalysis : cacheableMethods) {
@@ -358,51 +350,6 @@ public class TracerAspect {
return result;
}
- private Object cache(ProceedingJoinPoint joinPoint) throws Throwable {
- final Key key = new Key(joinPoint);
- return cache(key, joinPoint);
- }
-
-
- private Object cache(Object key, ProceedingJoinPoint joinPoint) throws Throwable {
-
- //already calculated
- //final Key key = new Key(joinPoint);
- //final SimpleKey key = (SimpleKey) joinPointKeyGenerator.generate(joinPoint);
- ValueWrapper value = cache.get(key);
-
- if (value != null) {
- logger.debug(key + " with value: " + value.get() + " got from cachemanager");
- return value.get();
- }
-
- Object result;
- try {
- result = joinPoint.proceed();
- } catch (Exception ex) {
- throw ex;
- }
-
- if (result != null) {
- //todo maximize such decision
- //maybe getcache info a lot can lead to a performance problem
-// if(cacheMonitor.getCacheInfo().getFreeSpace() > 0) {
- cache.put(key, result);
- logger.debug(key + " with value: " + result + " set in cachemanager");
-// }
- }
-
- return result;
- }
-
- /**
- * Clean cacheable methods expired.
- */
- private void clean() {
- cache.clear();
- logger.info("All cached values were removed.");
- }
-
private void stats() {
logger.debug("Tempo hash: " + hashAndStructureTime + " Tempo save: " + traceTime + " Count: " + count);
logger.debug("Mean Tempo hash: " + (hashAndStructureTime / count) + " Tempo save: " + (traceTime / count));
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/usersession/AnonymousUserGetter.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/usersession/AnonymousUserGetter.java
index 88f84b1..b4f9375 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/usersession/AnonymousUserGetter.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/application/usersession/AnonymousUserGetter.java
@@ -1,8 +1,5 @@
package br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.usersession;
-/**
- * Created by jhonnymertz on 22/11/16.
- */
public class AnonymousUserGetter implements UserGetter {
@Override
public String getCurrentUser() {
diff --git a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/RepositoryFactory.java b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/RepositoryFactory.java
index 78a227f..5403258 100644
--- a/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/RepositoryFactory.java
+++ b/framework/autonomicmanager/src/main/java/br/ufrgs/inf/prosoft/adaptivecaching/monitoring/storage/RepositoryFactory.java
@@ -3,6 +3,7 @@ package br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage;
import br.ufrgs.inf.prosoft.adaptivecaching.configuration.annotation.types.RepositoryType;
import br.ufrgs.inf.prosoft.adaptivecaching.exceptions.StorageException;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.LogTrace;
+import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.providers.*;
import com.mongodb.MongoClient;
import com.mongodb.MongoTimeoutException;
import com.mongodb.client.MongoDatabase;
@@ -36,7 +37,7 @@ public class RepositoryFactory {
return new RedisRepository<LogTrace>();
case TEXTFILE:
//TODO decouple it from redis and get of properties
- AsyncFileWriter as = new AsyncFileWriter(new File("traces.txt"));
+ AsyncFileRepository as = new AsyncFileRepository(new File("traces.txt"));
as.open();
logger.debug("Repository is configured to save logs in textfile.");
return as;
diff --git a/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/Learner.java b/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/Learner.java
index a84bd59..eceea9a 100644
--- a/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/Learner.java
+++ b/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/adaptivecaching/analysis/decision/flowchart/Learner.java
@@ -14,7 +14,7 @@ import br.ufrgs.inf.prosoft.adaptivecaching.configuration.annotation.types.Trigg
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.application.metadata.LogTrace;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.CacheMonitor;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.cache.vendors.ehcache.EhCacheMonitor;
-import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.MongoRepository;
+import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.providers.MongoRepository;
import br.ufrgs.inf.prosoft.adaptivecaching.monitoring.storage.Repository;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Output;
diff --git a/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/tests/adaptivecaching/MethodCacherTest.java b/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/tests/adaptivecaching/MethodCacherTest.java
index afe1e9f..50145d1 100644
--- a/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/tests/adaptivecaching/MethodCacherTest.java
+++ b/framework/autonomicmanager/src/test/java/br/ufrgs/inf/prosoft/tests/adaptivecaching/MethodCacherTest.java
@@ -1,6 +1,5 @@
package br.ufrgs.inf.prosoft.tests.adaptivecaching;
-import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher.extensions.provided.Tunnel;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.cacher.key.Key;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.extensions.ehcache.EhCacheCacheManager;
import br.ufrgs.inf.prosoft.adaptivecaching.cachemanager.model.Cache;
@@ -26,7 +25,7 @@ import java.lang.reflect.Method;
*/
public final class MethodCacherTest {
-// @Test
+ // @Test
public void testKeysCaching() throws Throwable {
CacheManager cm = CacheManager.newInstance();
//Create a Cache specifying its configuration.
@@ -121,36 +120,6 @@ public final class MethodCacherTest {
}
/**
- * MethodCacher can support garbage collecting.
- *
- * @throws Throwable If something goes wrong
- * @checkstyle IllegalThrowsCheck (3 lines)
- */
-// @Test
- public void supportsGarbageCollecting() throws Throwable {
- final ProceedingJoinPoint point = Mockito.mock(
- ProceedingJoinPoint.class
- );
- Mockito.when(point.proceed()).thenReturn(new Object());
- final Key key = Mockito.mock(
- Key.class
- );
- final Tunnel tunnel = new Tunnel(
- point, key, false
- );
- final MethodSignature methodSignature = Mockito.mock(
- MethodSignature.class
- );
- final Method method = Buzz.class.getMethod("get");
- Mockito.when(methodSignature.getMethod()).thenReturn(method);
- Mockito.when(point.getSignature()).thenReturn(methodSignature);
- tunnel.through();
- MatcherAssert.assertThat(tunnel.expired(), CoreMatchers.equalTo(false));
- tunnel.cached().clear();
- MatcherAssert.assertThat(tunnel.expired(), CoreMatchers.equalTo(true));
- }
-
- /**
* Test class for tests above.
*/
private static class Buzz {