Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed terracotta caches to support terracotta 3.1.0

updated to use oss.sonatype.org
renamed DistributedMapCache to reflect DistributedCache from Terracotta
  • Loading branch information...
commit e48858e6ca66754127b39786b96be0cf425747c3 1 parent aa4ef7f
@yestech authored
View
112 pom.xml
@@ -1,3 +1,4 @@
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -7,10 +8,45 @@
<version>1.0.0-SNAPSHOT</version>
<name>YES Cache</name>
<url>http://yestech.org</url>
+ <scm>
+ <connection>scm:git:http://github.com/yestech/yescache/tree/master</connection>
+ <developerConnection>scm:git:http://github.com/yestech/yescache/tree/master</developerConnection>
+ </scm>
+ <organization>
+ <name>YES Technology Association</name>
+ <url>http://yestech.org</url>
+ </organization>
+ <licenses>
+ <license>
+ <name>LGPLv3</name>
+ <url>http://opensource.org/licenses/lgpl-3.0.html</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <developers>
+ <developer>
+ <id>artie</id>
+ <name>Artie Copeland</name>
+ <email>artie@yestech.org</email>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>aj</id>
+ <name>AJ Wright</name>
+ <email>ayax79@gmail.com</email>
+ <roles>
+ <role>developer</role>
+ </roles>
+ </developer>
+ </developers>
<properties>
<tim-annotations.version>1.4.0</tim-annotations.version>
<tim-map-evictor.version>1.2.0</tim-map-evictor.version>
- <tim-terracotta-cache>1.2.1</tim-terracotta-cache>
+ <tim-distributed-cache>1.2.0</tim-distributed-cache>
+ <tim-tree-map-cache>1.4.0</tim-tree-map-cache>
</properties>
<dependencies>
<dependency>
@@ -75,27 +111,27 @@
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.terracotta.modules.beta</groupId>
+ <groupId>org.terracotta.modules</groupId>
<artifactId>tim-annotations</artifactId>
<version>${tim-annotations.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.terracotta.modules</groupId>
- <artifactId>tim-terracotta-cache</artifactId>
- <version>${tim-terracotta-cache}</version>
+ <artifactId>tim-distributed-cache</artifactId>
+ <version>${tim-distributed-cache}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- <version>1.6.0</version>
+ <groupId>org.terracotta.modules</groupId>
+ <artifactId>tim-tree-map-cache</artifactId>
+ <version>${tim-tree-map-cache}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.terracotta.modules.beta</groupId>
- <artifactId>tim-map-evictor</artifactId>
- <version>${tim-map-evictor.version}</version>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ <version>1.6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -142,12 +178,37 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.0-alpha-4</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
</profiles>
<pluginRepositories>
<pluginRepository>
+ <id>yestech-snapshots</id>
+ <name>YES Technology Snapshot Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/github-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
<id>codehaus</id>
<url>http://repository.codehaus.org</url>
</pluginRepository>
@@ -164,20 +225,18 @@
</pluginRepositories>
<repositories>
<repository>
- <id>yestech.thirdparty</id>
- <url>http://repo.yestech.org/content/repositories/thirdparty</url>
- </repository>
- <repository>
- <id>blackbox.thirdparty</id>
- <url>http://blackbox.yestech.org/content/repositories/thirdparty</url>
+ <id>yestech-snapshots</id>
+ <name>YES Technology Snapshot Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/github-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
</repository>
- <repository>
+<!--
+<repository>
<id>terracotta</id>
<url>http://repo.terracotta.org/maven2/</url>
<releases>
@@ -187,6 +246,7 @@
<enabled>true</enabled>
</snapshots>
</repository>
+-->
<repository>
<id>terracotta-repository</id>
<url>http://www.terracotta.org/download/reflector/maven2</url>
@@ -200,14 +260,14 @@
</repositories>
<distributionManagement>
<repository>
- <id>yestech.release</id>
- <name>Yestech release repository</name>
- <url>http://repo.yestech.org/content/repositories/releases</url>
+ <id>yestech-releases</id>
+ <name>YES Technology Release Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/github-releases/</url>
</repository>
<snapshotRepository>
- <id>yestech.snapshots</id>
- <name>Yestech snapshots repository</name>
- <url>http://repo.yestech.org/content/repositories/snapshots</url>
+ <id>yestech-snapshots</id>
+ <name>YES Technology Snapshot Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/github-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
View
224 src/main/java/org/yestech/cache/impl/TerracottaDistributedMapCacheManager.java
@@ -1,224 +0,0 @@
-/*
- * Copyright LGPL3
- * YES Technology Association
- * http://yestech.org
- *
- * http://www.opensource.org/licenses/lgpl-3.0.html
- */
-
-/*
- *
- * Author: Artie Copeland
- * Last Modified Date: $DateTime: $
- */
-package org.yestech.cache.impl;
-
-import org.yestech.cache.ICacheManager;
-import org.yestech.lib.util.Pair;
-import org.terracotta.modules.annotations.Root;
-import org.terracotta.modules.annotations.InstrumentedClass;
-import org.terracotta.modules.dmap.DistributedMap;
-import org.terracotta.modules.dmap.DistributedMapBuilder;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import java.util.Set;
-
-import static com.google.common.collect.Sets.newHashSet;
-
-/**
- * @author Artie Copeland
- * @version $Revision: $
- */
-@SuppressWarnings("unchecked")
-@InstrumentedClass
-public class TerracottaDistributedMapCacheManager<K,V> implements ICacheManager<K,V> {
-
- @Root
- private DistributedMap cache;
- private int maxTTIInSeconds;
- private int maxTTLInSeconds;
- private long evictorSleepInMillis;
- private int concurrency;
- private long orphanBatchPauseMillis;
- private int orphanBatchSize;
- private boolean orphanEvictionEnabled;
- private int orphanEvictionFrequency;
- private boolean evictorLogging;
- private boolean enableLogging;
-
- @PostConstruct
- public void start() {
- DistributedMapBuilder builder = new DistributedMapBuilder();
- if (maxTTIInSeconds > 0) {
- builder = builder.setMaxTTISeconds(maxTTIInSeconds);
- }
- if (maxTTLInSeconds > 0) {
- builder = builder.setMaxTTLSeconds(maxTTLInSeconds);
- }
-// if (evictorSleepInMillis > 0) {
-// builder = builder.setEvictorSleepMillis(evictorSleepInMillis);
-// }
- if (concurrency > 0) {
- builder = builder.setConcurrency(concurrency);
- }
-// if (orphanBatchPauseMillis > 0) {
-// builder = builder.setOrphanBatchPauseMillis(orphanBatchPauseMillis);
-// }
-// if (orphanBatchSize > 0) {
-// builder = builder.setOrphanBatchSize(orphanBatchSize);
-// }
- if (orphanEvictionEnabled) {
- builder = builder.setOrphanEvictionEnabled(orphanEvictionEnabled);
- }
- if (orphanEvictionFrequency > 0) {
- builder = builder.setOrphanEvictionFrequency(orphanEvictionFrequency);
- }
- if (evictorLogging) {
- builder = builder.setEvictorLoggingEnabled(evictorLogging);
- }
- if (enableLogging) {
- builder = builder.setLoggingEnabled(enableLogging);
- }
- cache = builder.newMap();
- if (cache != null) {
- cache.start();
- }
- }
-
- @PreDestroy
- public void stop() {
- if (cache != null) {
- cache.shutdown();
- }
- }
-
- public long getOrphanBatchPauseMillis() {
- return orphanBatchPauseMillis;
- }
-
- public void setOrphanBatchPauseMillis(long orphanBatchPauseMillis) {
- this.orphanBatchPauseMillis = orphanBatchPauseMillis;
- }
-
- public long getOrphanBatchSize() {
- return orphanBatchSize;
- }
-
- public void setOrphanBatchSize(int orphanBatchSize) {
- this.orphanBatchSize = orphanBatchSize;
- }
-
- public long getOrphanEvictionFrequency() {
- return orphanEvictionFrequency;
- }
-
- public void setOrphanEvictionFrequency(int orphanEvictionFrequency) {
- this.orphanEvictionFrequency = orphanEvictionFrequency;
- }
-
- public boolean isOrphanEvictionEnabled() {
- return orphanEvictionEnabled;
- }
-
- public void setOrphanEvictionEnabled(boolean orphanEvictionEnabled) {
- this.orphanEvictionEnabled = orphanEvictionEnabled;
- }
-
- public boolean isEvictorLogging() {
- return evictorLogging;
- }
-
- public void setEvictorLogging(boolean evictorLogging) {
- this.evictorLogging = evictorLogging;
- }
-
- public boolean isEnableLogging() {
- return enableLogging;
- }
-
- public void setEnableLogging(boolean enableLogging) {
- this.enableLogging = enableLogging;
- }
-
- public int getConcurrency() {
- return concurrency;
- }
-
- public void setConcurrency(int concurrency) {
- this.concurrency = concurrency;
- }
-
- public int getMaxTTIInSeconds() {
- return maxTTIInSeconds;
- }
-
- public void setMaxTTIInSeconds(int maxTTIInSeconds) {
- this.maxTTIInSeconds = maxTTIInSeconds;
- }
-
- public int getMaxTTLInSeconds() {
- return maxTTLInSeconds;
- }
-
- public void setMaxTTLInSeconds(int maxTTLInSeconds) {
- this.maxTTLInSeconds = maxTTLInSeconds;
- }
-
- public long getEvictorSleepInMillis() {
- return evictorSleepInMillis;
- }
-
- public void setEvictorSleepInMillis(long evictorSleepInMillis) {
- this.evictorSleepInMillis = evictorSleepInMillis;
- }
-
- @Override
- public boolean contains(K k) {
- return cache.containsKey(k);
- }
-
- @Override
- public void put(Pair<K, V> entry) {
- put(entry.getFirst(), entry.getSecond());
- }
-
- @Override
- public void put(K k, V v) {
- cache.put(k, v);
- }
-
- @Override
- public V get(K key) {
- return (V) cache.get(key);
- }
-
- @Override
- public void flushAll() {
- cache.clear();
- }
-
- @Override
- public void flush(K key) {
- cache.remove(key);
- }
-
- @Override
- public Set<K> keySet() {
- return cache.keySet();
- }
-
- @Override
- public Set<V> getAll() {
- Set<V> values = newHashSet();
- Set<K> keys = keySet();
- if (keys == null) {
- return null;
- } else {
- for (K key : keys) {
- values.add(get(key));
- }
- }
- return values;
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.