You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directmemory.apache.org by ol...@apache.org on 2013/06/22 15:35:30 UTC
svn commit: r1495725 - in /directmemory/trunk:
integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
pom.xml
Author: olamy
Date: Sat Jun 22 13:35:30 2013
New Revision: 1495725
URL: http://svn.apache.org/r1495725
Log:
[DIRECTMEMORY-126] upgrade to ehcache 2.6.6
Modified:
directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
directmemory/trunk/pom.xml
Modified: directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
URL: http://svn.apache.org/viewvc/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java?rev=1495725&r1=1495724&r2=1495725&view=diff
==============================================================================
--- directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java (original)
+++ directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java Sat Jun 22 13:35:30 2013
@@ -21,16 +21,24 @@ package net.sf.ehcache.store.offheap;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.pool.Pool;
import net.sf.ehcache.pool.PoolableStore;
import net.sf.ehcache.pool.impl.UnboundedPool;
+import net.sf.ehcache.search.NullResults;
+import net.sf.ehcache.search.Results;
+import net.sf.ehcache.search.attribute.AttributeExtractor;
+import net.sf.ehcache.search.attribute.DynamicAttributesExtractor;
+import net.sf.ehcache.search.impl.SearchManager;
import net.sf.ehcache.store.FrontEndCacheTier;
import net.sf.ehcache.store.MemoryStore;
import net.sf.ehcache.store.Store;
+import net.sf.ehcache.store.StoreQuery;
import net.sf.ehcache.store.disk.DiskStore;
import org.apache.directmemory.ehcache.DirectMemoryStore;
+import java.util.Map;
import java.util.WeakHashMap;
/**
@@ -52,13 +60,14 @@ public class OffHeapStore
CacheConfiguration config = cache.getCacheConfiguration();
MemoryStore memoryStore = createMemoryStore( cache, onHeapPool );
- DirectMemoryStore offHeapStore = createOffHeapStore( cache, true );
+ DirectMemoryStore offHeapStore = createOffHeapStore( cache );
DiskStore diskStore = null; //need to implement disk backing to store.
Store store = null;
if ( diskStore == null )
{
store = new FrontEndCacheTier<MemoryStore, DirectMemoryStore>( memoryStore, offHeapStore,
config.getCopyStrategy(),
+ new MockSearchManager(),
config.isCopyOnWrite(),
config.isCopyOnRead() )
{
@@ -75,6 +84,38 @@ public class OffHeapStore
}
/**
+ * TODO create a real {@link SearchManager}
+ */
+ private static class MockSearchManager implements SearchManager
+ {
+ @Override
+ public Results executeQuery( String s, StoreQuery storeQuery,
+ Map<String, AttributeExtractor> stringAttributeExtractorMap )
+ {
+ return new NullResults();
+ }
+
+ @Override
+ public void put( String s, int i, Element element, Map<String, AttributeExtractor> stringAttributeExtractorMap,
+ DynamicAttributesExtractor dynamicAttributesExtractor )
+ {
+ // no op
+ }
+
+ @Override
+ public void remove( String s, Object o, int i, boolean b )
+ {
+ // no op
+ }
+
+ @Override
+ public void clear( String s, int i )
+ {
+ // no op
+ }
+ }
+
+ /**
* Creates a persitent-to-disk store for the given cache, using the given
* disk path. Heap and disk usage are not tracked by the returned store.
*
@@ -92,7 +133,12 @@ public class OffHeapStore
return MemoryStore.create( cache, onHeapPool );
}
- private static DirectMemoryStore createOffHeapStore( Ehcache cache, boolean lowestTier )
+ /**
+ * <b>do not use directly as can change</b>
+ * @param cache
+ * @return
+ */
+ public static DirectMemoryStore createOffHeapStore( Ehcache cache )
{
Pool<PoolableStore> offHeapPool = null;
if ( cache.getCacheConfiguration().getMaxBytesLocalOffHeap() == 0L )
@@ -102,7 +148,12 @@ public class OffHeapStore
return new DirectMemoryStore( cache, offHeapPool );
}
- private static Pool<PoolableStore> getOffHeapPool( CacheManager manager )
+ /**
+ * <b>do not use directly as can change</b>
+ * @param manager
+ * @return
+ */
+ public static Pool<PoolableStore> getOffHeapPool( CacheManager manager )
{
Pool<PoolableStore> pool;
synchronized ( OFFHEAP_POOLS )
Modified: directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
URL: http://svn.apache.org/viewvc/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java?rev=1495725&r1=1495724&r2=1495725&view=diff
==============================================================================
--- directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java (original)
+++ directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java Sat Jun 22 13:35:30 2013
@@ -40,7 +40,9 @@ import org.slf4j.LoggerFactory;
import java.nio.BufferOverflowException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -566,13 +568,32 @@ public class DirectMemoryStore
}
@Override
- public boolean removeIfTierNotPinned( Object key )
+ public boolean removeIfNotPinned( Object key )
{
- //no operation
return false;
}
@Override
+ public boolean isTierPinned()
+ {
+ return false;
+ }
+
+ @Override
+ public Set getPresentPinnedKeys()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isPersistent()
+ {
+ return false;
+ }
+
+
+
+ @Override
public void removeNoReturn( Object key )
{
//no operation
Modified: directmemory/trunk/pom.xml
URL: http://svn.apache.org/viewvc/directmemory/trunk/pom.xml?rev=1495725&r1=1495724&r2=1495725&view=diff
==============================================================================
--- directmemory/trunk/pom.xml (original)
+++ directmemory/trunk/pom.xml Sat Jun 22 13:35:30 2013
@@ -60,12 +60,12 @@ under the License.
</issueManagement>
<ciManagement>
<system>Jenkins</system>
- <url>https://builds.apache.org/view/A-F/view/Directmemory/</url>
+ <url>https://builds.apache.org/job/directmemory-trunk/</url>
</ciManagement>
<distributionManagement>
<site>
<id>apache.website</id>
- <url>${siteUrlDeployment}</url>
+ <url>scm:svn:https://svn.apache.org/repos/asf/directmemory/site-content/</url>
</site>
</distributionManagement>
@@ -79,8 +79,8 @@ under the License.
<aspectj.bundle.version>1.6.8_2</aspectj.bundle.version>
<aspectj.version>1.6.12</aspectj.version>
<doclava.version>1.0.5</doclava.version>
- <ehcache.version>2.5.0</ehcache.version>
- <ehcache.bundle.version>2.5.0_2</ehcache.bundle.version>
+ <ehcache.version>2.6.6</ehcache.version>
+ <ehcache.bundle.version>2.6.6_1</ehcache.bundle.version>
<guava.bundle.version>09_1</guava.bundle.version>
<guava.version>r09</guava.version>
<h2.version>1.3.158</h2.version>