Author: bperroud
Date: Sat Feb 25 10:16:25 2012
New Revision: 1293567
URL: http://svn.apache.org/viewvc?rev=1293567&view=rev
Log:
DIRECTMEMORY-60 : EHCache Integration, thanks to Michael Andre Pearce for his
contribution
Added:
incubator/directmemory/trunk/integrations/ehcache/
incubator/directmemory/trunk/integrations/ehcache/pom.xml
incubator/directmemory/trunk/integrations/ehcache/src/
incubator/directmemory/trunk/integrations/ehcache/src/main/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryCache.java
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/NotifyingDirectMemoryStore.java
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyEhcacheImpl.java
incubator/directmemory/trunk/integrations/ehcache/src/test/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/EHCacheTest.java
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/ehcache.xml
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/logback-test.xml
Modified:
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java
Modified:
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java?rev=1293567&r1=1293566&r2=1293567&view=diff
==============================================================================
---
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java
(original)
+++
incubator/directmemory/trunk/directmemory-cache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyImpl.java
Sat Feb 25 10:16:25 2012
@@ -1,5 +1,7 @@
package org.apache.directmemory.memory;
+import java.nio.BufferOverflowException;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,6 +30,8 @@ public class MemoryManagerServiceWithAll
extends MemoryManagerServiceImpl<V>
{
+ protected boolean returnNullWhenFull = true;
+
protected AllocationPolicy<V> allocationPolicy;
@Override
@@ -59,7 +63,14 @@ public class MemoryManagerServiceWithAll
buffer = allocationPolicy.getActiveBuffer( buffer,
allocationNumber );
if ( buffer == null )
{
- return null;
+ if (returnNullWhenFull)
+ {
+ return null;
+ }
+ else
+ {
+ throw new BufferOverflowException();
+ }
}
p = buffer.store( payload, expiresIn );
allocationNumber++;
@@ -86,7 +97,14 @@ public class MemoryManagerServiceWithAll
buffer = allocationPolicy.getActiveBuffer( buffer,
allocationNumber );
if ( buffer == null )
{
- return null;
+ if (returnNullWhenFull)
+ {
+ return null;
+ }
+ else
+ {
+ throw new BufferOverflowException();
+ }
}
p = buffer.allocate( type, size, expiresIn, expires );
allocationNumber++;
Added: incubator/directmemory/trunk/integrations/ehcache/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/pom.xml?rev=1293567&view=auto
==============================================================================
--- incubator/directmemory/trunk/integrations/ehcache/pom.xml (added)
+++ incubator/directmemory/trunk/integrations/ehcache/pom.xml Sat Feb 25
10:16:25 2012
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership. The
ASF licenses this file to you 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. -->
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.directmemory</groupId>
+ <artifactId>directmemory-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ <relativePath>../../</relativePath>
+ </parent>
+
+ <artifactId>directmemory-ehcache</artifactId>
+ <name>Apache DirectMemory :: Integrations :: EHCache</name>
+ <description>EHCache CacheStore Implementation to integrate
DirectMemory Cache as OffHeapStore.
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+
<directory>logs</directory>
+
<followSymlinks>false</followSymlinks>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <argLine>-Xmx512m -Xms512m
-XX:MaxDirectMemorySize=512m</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- DirectMemory Dependency -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>directmemory-cache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- EHCache Dependency -->
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache-core</artifactId>
+ <version>2.5.0</version>
+ </dependency>
+
+ <!-- Testing Dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <url>http://repo.fusesource.com/maven2</url>
+ <id>fusesource</id>
+ </repository>
+ <repository>
+ <id>sonatype-nexus-public</id>
+ <name>SonaType public snapshots and releases
repository</name>
+
<url>https://oss.sonatype.org/content/groups/public</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+
+ </repositories>
+
+</project>
Added:
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/main/java/net/sf/ehcache/store/offheap/OffHeapStore.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,120 @@
+package net.sf.ehcache.store.offheap;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.util.WeakHashMap;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+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.store.FrontEndCacheTier;
+import net.sf.ehcache.store.MemoryStore;
+import net.sf.ehcache.store.Store;
+import net.sf.ehcache.store.disk.DiskStore;
+
+import org.apache.directmemory.ehcache.DirectMemoryStore;
+
+/**
+ * This class is simply a connector class into the EHCache for OffHeap.
+ * @author michaelandrepearce
+ *
+ */
+public class OffHeapStore
+{
+
+ private static final WeakHashMap<CacheManager, Pool<PoolableStore>>
OFFHEAP_POOLS = new WeakHashMap<CacheManager, Pool<PoolableStore>>();
+
+ public static Store create( Ehcache cache, String diskStorePath,
Pool<PoolableStore> onHeapPool,
+ Pool<PoolableStore> onDiskPool )
+ {
+
+ CacheConfiguration config = cache.getCacheConfiguration();
+ MemoryStore memoryStore = createMemoryStore( cache, onHeapPool );
+ DirectMemoryStore offHeapStore = createOffHeapStore( cache, true );
+ 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(),
+
config.isCopyOnWrite(),
+
config.isCopyOnRead() )
+ {
+
+ @Override
+ public Object getMBean()
+ {
+ return this.authority.getMBean();
+ }
+
+ };
+ }
+ return store;
+ }
+
+ /**
+ * 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.
+ *
+ * @param cache
+ * cache that fronts this store
+ * @param diskStorePath
+ * disk path to store data in
+ * @return a fully initialized store
+ */
+ public static Store create( Ehcache cache, String diskStorePath )
+ {
+ return create( cache, diskStorePath, new UnboundedPool(), new
UnboundedPool() );
+ }
+
+ private static MemoryStore createMemoryStore( Ehcache cache,
Pool<PoolableStore> onHeapPool )
+ {
+ return MemoryStore.create( cache, onHeapPool );
+ }
+
+ private static DirectMemoryStore createOffHeapStore( Ehcache cache,
boolean lowestTier )
+ {
+ Pool<PoolableStore> offHeapPool = null;
+ if ( cache.getCacheConfiguration().getMaxBytesLocalOffHeap() == 0L )
+ {
+ offHeapPool = getOffHeapPool( cache.getCacheManager() );
+ }
+ return new DirectMemoryStore( cache, offHeapPool );
+ }
+
+ private static Pool<PoolableStore> getOffHeapPool( CacheManager manager )
+ {
+ Pool<PoolableStore> pool;
+ synchronized ( OFFHEAP_POOLS )
+ {
+ pool = OFFHEAP_POOLS.get( manager );
+ if ( pool == null )
+ {
+ pool = new UnboundedPool();
+ OFFHEAP_POOLS.put( manager, pool );
+ }
+ }
+ return pool;
+ }
+
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryCache.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryCache.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryCache.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryCache.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,188 @@
+package org.apache.directmemory.ehcache;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.util.Set;
+
+import org.apache.directmemory.cache.CacheService;
+import org.apache.directmemory.cache.CacheServiceImpl;
+import org.apache.directmemory.memory.MemoryManagerService;
+import
org.apache.directmemory.memory.MemoryManagerServiceWithAllocationPolicyEhcacheImpl;
+import org.apache.directmemory.memory.OffHeapMemoryBuffer;
+import org.apache.directmemory.memory.Pointer;
+import org.apache.directmemory.memory.RoundRobinAllocationPolicy;
+import org.apache.directmemory.serialization.Serializer;
+
+/**
+ *
+ * @author michaelandrepearce
+ *
+ * @param <K>
+ * @param <V>
+ */
+public class DirectMemoryCache<K, V>
+{
+
+ private MemoryManagerService<V> memoryManager = new
MemoryManagerServiceWithAllocationPolicyEhcacheImpl<V>(
+
new RoundRobinAllocationPolicy<V>() );
+
+ private CacheServiceImpl<K, V> cacheService = new CacheServiceImpl<K, V>(
memoryManager );
+
+ public DirectMemoryCache( int numberOfBuffers, int size, int
initialCapacity, int concurrencyLevel )
+ {
+ cacheService.init( numberOfBuffers, size, initialCapacity,
concurrencyLevel );
+ }
+
+ public DirectMemoryCache( int numberOfBuffers, int size )
+ {
+ this( numberOfBuffers, size, CacheService.DEFAULT_INITIAL_CAPACITY,
CacheService.DEFAULT_CONCURRENCY_LEVEL );
+ }
+
+ public void scheduleDisposalEvery( long l )
+ {
+ cacheService.scheduleDisposalEvery( l );
+ }
+
+ public Pointer<V> putByteArray( K key, byte[] payload, int expiresIn )
+ {
+ return cacheService.putByteArray( key, payload, expiresIn );
+ }
+
+ public Pointer<V> putByteArray( K key, byte[] payload )
+ {
+ return cacheService.putByteArray( key, payload );
+ }
+
+ public Pointer<V> put( K key, V value )
+ {
+ return cacheService.put( key, value );
+ }
+
+ public Pointer<V> put( K key, V value, int expiresIn )
+ {
+ return cacheService.put( key, value, expiresIn );
+ }
+
+ public byte[] retrieveByteArray( K key )
+ {
+ return cacheService.retrieveByteArray( key );
+ }
+
+ public V retrieve( K key )
+ {
+ return cacheService.retrieve( key );
+ }
+
+ public Pointer<V> getPointer( K key )
+ {
+ return cacheService.getPointer( key );
+ }
+
+ public void free( K key )
+ {
+ cacheService.free( key );
+ }
+
+ public void free( Pointer<V> pointer )
+ {
+ cacheService.free( pointer );
+ }
+
+ public void collectExpired()
+ {
+ cacheService.collectExpired();
+ }
+
+ public void collectLFU()
+ {
+ cacheService.collectLFU();
+ }
+
+ public void collectAll()
+ {
+ cacheService.collectAll();
+ }
+
+ public void clear()
+ {
+ cacheService.clear();
+ }
+
+ public long size()
+ {
+ return cacheService.entries();
+ }
+
+ public long sizeInBytes()
+ {
+ long i = 0;
+ for ( OffHeapMemoryBuffer<V> buffer : getMemoryManager().getBuffers() )
+ {
+ i += buffer.used();
+ }
+ return i;
+ }
+
+ public long capacityInBytes()
+ {
+ long i = 0;
+ for ( OffHeapMemoryBuffer<V> buffer : getMemoryManager().getBuffers() )
+ {
+ i += buffer.capacity();
+ }
+ return i;
+ }
+
+ public void dump( OffHeapMemoryBuffer<V> mem )
+ {
+ cacheService.dump( mem );
+ }
+
+ public void dump()
+ {
+ cacheService.dump();
+ }
+
+ public Serializer getSerializer()
+ {
+ return cacheService.getSerializer();
+ }
+
+ public MemoryManagerService<V> getMemoryManager()
+ {
+ return cacheService.getMemoryManager();
+ }
+
+ public Pointer<V> allocate( K key, Class<V> type, int size )
+ {
+ return cacheService.allocate( key, type, size );
+ }
+
+ public Set<K> getKeys()
+ {
+ return cacheService.getMap().keySet();
+ }
+
+ public boolean containsKey( K key )
+ {
+ return cacheService.getMap().containsKey( key );
+ }
+
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/DirectMemoryStore.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,607 @@
+package org.apache.directmemory.ehcache;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import static java.lang.String.format;
+
+import java.nio.BufferOverflowException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheEntry;
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.Status;
+import net.sf.ehcache.pool.Pool;
+import net.sf.ehcache.pool.PoolableStore;
+import net.sf.ehcache.store.AbstractStore;
+import net.sf.ehcache.store.ElementValueComparator;
+import net.sf.ehcache.store.Policy;
+import net.sf.ehcache.store.TierableStore;
+import net.sf.ehcache.store.disk.StoreUpdateException;
+import net.sf.ehcache.writer.CacheWriterManager;
+
+import org.apache.directmemory.cache.CacheServiceImpl;
+import org.apache.directmemory.measures.Ram;
+import org.apache.directmemory.memory.OffHeapMemoryBuffer;
+import org.apache.directmemory.memory.Pointer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DirectMemoryStore
+ extends AbstractStore
+ implements TierableStore, PoolableStore
+{
+
+ private static Logger logger = LoggerFactory.getLogger(
CacheServiceImpl.class );
+
+ public static final int DEFAULT_NUMBER_BYTE_BUFFERS = 64;
+
+ public static final int DEFAULT_BUFFER_SIZE = Ram.Mb( 40 );
+
+ private List<ReentrantLock> bufferLocks;
+
+ DirectMemoryCache<Object, Element> directMemoryCache;
+
+ public DirectMemoryStore( Ehcache cache, Pool<PoolableStore> offHeapPool )
+ {
+ this( cache, offHeapPool, false );
+ }
+
+ public DirectMemoryStore( Ehcache cache, Pool<PoolableStore> offHeapPool,
boolean doNotifications )
+ {
+ long offHeapSizeBytes;
+ if ( cache == null || cache.getCacheConfiguration() == null )
+ {
+ offHeapSizeBytes = Ram.Mb( 64 );
+ }
+ else
+ {
+ offHeapSizeBytes =
cache.getCacheConfiguration().getMaxMemoryOffHeapInBytes();
+ }
+ init( offHeapSizeBytes );
+ }
+
+ public DirectMemoryStore( long offHeapSizeBytes )
+ {
+ init( offHeapSizeBytes );
+ }
+
+ private void init( long offHeapSizeBytes )
+ {
+ logger.info( " ___ __ __ _ _ ____ _
" );
+ logger.info( " / _ \\ / _|/ _| | | | ___ __ _ _ __/ ___|| |_ ___ _
__ ___ " );
+ logger.info( " | | | | |_| |_| |_| |/ _ \\/ _` | '_ \\___ \\| __/ _
\\| '__/ _ \\" );
+ logger.info( " | |_| | _| _| _ | __/ (_| | |_) |__) | || (_) | |
| __/" );
+ logger.info( " \\___/|_| |_| |_| |_|\\___|\\__,_| .__/____/
\\__\\___/|_| \\___|" );
+ logger.info( " |_|
" );
+
+ logger.info( "default buffer size = " + DEFAULT_BUFFER_SIZE );
+ logger.info( "off heap size = " + offHeapSizeBytes );
+ int numberOfBuffers = (int) ( offHeapSizeBytes / DEFAULT_BUFFER_SIZE );
+ numberOfBuffers = DEFAULT_NUMBER_BYTE_BUFFERS;
+ logger.info( "no of buffers = " + numberOfBuffers );
+
+ this.bufferLocks = new ArrayList<ReentrantLock>( numberOfBuffers );
+ for ( int i = 0; i < numberOfBuffers; i++ )
+ {
+ this.bufferLocks.add( new ReentrantLock() );
+ }
+
+ directMemoryCache = new DirectMemoryCache<Object, Element>(
numberOfBuffers,
+ (int) (
offHeapSizeBytes / numberOfBuffers ) );
+ }
+
+ @Override
+ public void unpinAll()
+ {
+ //no operation
+
+ }
+
+ @Override
+ public boolean isPinned( Object key )
+ {
+ return false;
+ }
+
+ @Override
+ public void setPinned( Object key, boolean pinned )
+ {
+ //no operation
+
+ }
+
+ @Override
+ public boolean put( Element element )
+ throws CacheException
+ {
+ Pointer<Element> pointer = null;
+ try
+ {
+ pointer = directMemoryCache.put( element.getObjectKey(), element );
+ }
+ catch ( BufferOverflowException boe )
+ {
+ dump();
+ throw new CacheException( "DirectMemory OffHeap Memory Exceeded",
boe );
+ }
+ return null == pointer ? false : true;
+ }
+
+ @Override
+ public boolean putWithWriter( Element element, CacheWriterManager
writerManager )
+ throws CacheException
+ {
+ boolean newPut = put( element );
+ if ( writerManager != null )
+ {
+ try
+ {
+ writerManager.put( element );
+ }
+ catch ( RuntimeException e )
+ {
+ throw new StoreUpdateException( e, !newPut );
+ }
+ }
+ return newPut;
+ }
+
+ @Override
+ public Element get( Object key )
+ {
+ return directMemoryCache.retrieve( key );
+ }
+
+ @Override
+ public Element getQuiet( Object key )
+ {
+ return get( key );
+ }
+
+ @Override
+ public List<Object> getKeys()
+ {
+ return new ArrayList<Object>( directMemoryCache.getKeys() );
+ }
+
+ @Override
+ public Element remove( Object key )
+ {
+ Element element = get( key );
+ directMemoryCache.free( key );
+ return element;
+
+ }
+
+ @Override
+ public Element removeWithWriter( Object key, CacheWriterManager
writerManager )
+ throws CacheException
+ {
+ Element removed = remove( key );
+ if ( writerManager != null )
+ {
+ writerManager.remove( new CacheEntry( key, removed ) );
+ }
+ return removed;
+ }
+
+ @Override
+ public void removeAll()
+ throws CacheException
+ {
+ directMemoryCache.clear();
+ }
+
+ @Override
+ public Element putIfAbsent( Element element )
+ throws NullPointerException
+ {
+ Element returnElement = get( element.getObjectKey() );
+ if ( null == returnElement )
+ {
+ put( element );
+ returnElement = element;
+ }
+ return returnElement;
+ }
+
+ @Override
+ public Element removeElement( Element element, ElementValueComparator
comparator )
+ throws NullPointerException
+ {
+ if ( element == null || element.getObjectKey() == null )
+ {
+ return null;
+ }
+ Pointer<Element> pointer = directMemoryCache.getPointer(
element.getObjectKey() );
+ if ( pointer == null )
+ {
+ return null;
+ }
+
+ Lock lock = bufferLocks.get( pointer.bufferNumber );
+ lock.lock();
+ try
+ {
+ Element toRemove = directMemoryCache.retrieve(
element.getObjectKey() );
+ if ( comparator.equals( element, toRemove ) )
+ {
+ directMemoryCache.free( element.getObjectKey() );
+ return toRemove;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public boolean replace( Element old, Element element,
ElementValueComparator comparator )
+ throws NullPointerException, IllegalArgumentException
+ {
+ if ( element == null || element.getObjectKey() == null )
+ {
+ return false;
+ }
+ Pointer<Element> pointer = directMemoryCache.getPointer(
element.getObjectKey() );
+ if ( pointer == null )
+ {
+ return false;
+ }
+
+ Lock lock = bufferLocks.get( pointer.bufferNumber );
+ lock.lock();
+ try
+ {
+ Element toUpdate = directMemoryCache.retrieve(
element.getObjectKey() );
+ if ( comparator.equals( old, toUpdate ) )
+ {
+ directMemoryCache.put( element.getObjectKey(), element );
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ dump();
+ throw new CacheException( "DirectMemory OffHeap Memory Exceeded",
boe );
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public Element replace( Element element )
+ throws NullPointerException
+ {
+ if ( element == null || element.getObjectKey() == null )
+ {
+ return null;
+ }
+ Pointer<Element> pointer = directMemoryCache.getPointer(
element.getObjectKey() );
+ if ( pointer == null )
+ {
+ return null;
+ }
+
+ Lock lock = bufferLocks.get( pointer.bufferNumber );
+ lock.lock();
+ try
+ {
+ Element toUpdate = directMemoryCache.retrieve(
element.getObjectKey() );
+ if ( null != toUpdate )
+ {
+ directMemoryCache.put( element.getObjectKey(), element );
+ return toUpdate;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ catch ( BufferOverflowException boe )
+ {
+ dump();
+ throw new CacheException( "DirectMemory OffHeap Memory Exceeded",
boe );
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+
+ @Override
+ public synchronized void dispose()
+ {
+ flush();
+ }
+
+ @Override
+ public int getSize()
+ {
+ return getOffHeapSize();
+ }
+
+ @Override
+ public int getInMemorySize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public int getOffHeapSize()
+ {
+ long size = directMemoryCache.size();
+ if ( size > Integer.MAX_VALUE )
+ {
+ return Integer.MAX_VALUE;
+ }
+ else
+ {
+ return (int) size;
+ }
+ }
+
+ @Override
+ public int getOnDiskSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public int getTerracottaClusteredSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getInMemorySizeInBytes()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getOffHeapSizeInBytes()
+ {
+ return directMemoryCache.sizeInBytes();
+ }
+
+ @Override
+ public long getOnDiskSizeInBytes()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public Status getStatus()
+ {
+ //no operation
+ return null;
+ }
+
+ @Override
+ public boolean containsKey( Object key )
+ {
+ return containsKeyOffHeap( key );
+ }
+
+ @Override
+ public boolean containsKeyOnDisk( Object key )
+ {
+ //no operation
+ return false;
+ }
+
+ @Override
+ public boolean containsKeyOffHeap( Object key )
+ {
+ return directMemoryCache.containsKey( key );
+ }
+
+ @Override
+ public boolean containsKeyInMemory( Object key )
+ {
+ //no operation
+ return false;
+ }
+
+ @Override
+ public void expireElements()
+ {
+ //no operation
+
+ }
+
+ @Override
+ public void flush()
+ {
+ directMemoryCache.clear();
+ }
+
+ @Override
+ public boolean bufferFull()
+ {
+ //never backs up/ no buffer used.
+ return false;
+ }
+
+ @Override
+ public Policy getInMemoryEvictionPolicy()
+ {
+ //no operation
+ return null;
+ }
+
+ @Override
+ public void setInMemoryEvictionPolicy( Policy policy )
+ {
+ //no operation
+
+ }
+
+ @Override
+ public Object getInternalContext()
+ {
+ //no operation
+ return null;
+ }
+
+ @Override
+ public Object getMBean()
+ {
+ //no operation
+ return null;
+ }
+
+ @Override
+ public boolean evictFromOnHeap( int count, long size )
+ {
+ //no operation
+ return false;
+ }
+
+ @Override
+ public boolean evictFromOnDisk( int count, long size )
+ {
+ //no operation
+ return false;
+ }
+
+ @Override
+ public float getApproximateDiskHitRate()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public float getApproximateDiskMissRate()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getApproximateDiskCountSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getApproximateDiskByteSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public float getApproximateHeapHitRate()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public float getApproximateHeapMissRate()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getApproximateHeapCountSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public long getApproximateHeapByteSize()
+ {
+ //no operation
+ return 0;
+ }
+
+ @Override
+ public void fill( Element e )
+ {
+ put( e );
+ }
+
+ @Override
+ public boolean removeIfTierNotPinned( Object key )
+ {
+ //no operation
+ return false;
+ }
+
+ @Override
+ public void removeNoReturn( Object key )
+ {
+ //no operation
+
+ }
+
+ public void dump()
+ {
+ directMemoryCache.dump();
+ }
+
+ public void dumpTotal()
+ {
+ long capacity = 0;
+ long used = 0;
+ for ( OffHeapMemoryBuffer<Element> buffer :
directMemoryCache.getMemoryManager().getBuffers() )
+ {
+ capacity += buffer.capacity();
+ used += buffer.used();
+ }
+ logger.info( "***Totals***************************************" );
+ logger.info( format( "off-heap - # buffers: \t%1d",
directMemoryCache.getMemoryManager().getBuffers().size() ) );
+ logger.info( format( "off-heap - allocated: \t%1s", Ram.inMb( capacity
) ) );
+ logger.info( format( "off-heap - used: \t%1s", Ram.inMb( used ) )
);
+ logger.info( format( "heap - max: \t%1s", Ram.inMb(
Runtime.getRuntime().maxMemory() ) ) );
+ logger.info( format( "heap - allocated: \t%1s", Ram.inMb(
Runtime.getRuntime().totalMemory() ) ) );
+ logger.info( format( "heap - free : \t%1s", Ram.inMb(
Runtime.getRuntime().freeMemory() ) ) );
+ logger.info( "************************************************" );
+ }
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/NotifyingDirectMemoryStore.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/NotifyingDirectMemoryStore.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/NotifyingDirectMemoryStore.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/ehcache/NotifyingDirectMemoryStore.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,71 @@
+package org.apache.directmemory.ehcache;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.pool.Pool;
+import net.sf.ehcache.pool.PoolableStore;
+
+public class NotifyingDirectMemoryStore
+ extends DirectMemoryStore
+{
+
+ private final Ehcache cache;
+
+ private NotifyingDirectMemoryStore( Ehcache cache, Pool<PoolableStore>
pool )
+ {
+ super( cache, pool, true );
+ this.cache = cache;
+ }
+
+ public static NotifyingDirectMemoryStore create( Ehcache cache,
Pool<PoolableStore> pool )
+ {
+ NotifyingDirectMemoryStore store = new NotifyingDirectMemoryStore(
cache, pool );
+ return store;
+ }
+
+ protected boolean evict( Element element )
+ {
+ Element remove = remove( element.getObjectKey() );
+ if ( remove != null )
+ {
+
this.cache.getCacheEventNotificationService().notifyElementEvicted( element,
false );
+ }
+ return remove != null;
+ }
+
+ protected void notifyDirectEviction( Element element )
+ {
+ this.cache.getCacheEventNotificationService().notifyElementEvicted(
element, false );
+ }
+
+ public void expireElements()
+ {
+ for ( Object key : this.getKeys() )
+ {
+ //expire element check if it is expired, if it is expired remove
from cache and return element
+ //.iskeyvalid()
+ Element element = remove( key );
+ if ( element != null )
+
this.cache.getCacheEventNotificationService().notifyElementExpiry( element,
false );
+ }
+ }
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyEhcacheImpl.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyEhcacheImpl.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyEhcacheImpl.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/main/java/org/apache/directmemory/memory/MemoryManagerServiceWithAllocationPolicyEhcacheImpl.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,39 @@
+package org.apache.directmemory.memory;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * Extends {@link MemoryManagerServiceWithAllocationPolicyImpl}
+ * to force {@link AllocationPolicy} in constructor and set
+ * the behavior to thrown an exception when the buffers are full.
+ *
+ */
+public class MemoryManagerServiceWithAllocationPolicyEhcacheImpl<V>
+ extends MemoryManagerServiceWithAllocationPolicyImpl<V>
+{
+
+ public MemoryManagerServiceWithAllocationPolicyEhcacheImpl(
AllocationPolicy<V> allocationPolicy )
+ {
+ super();
+ this.setAllocationPolicy( allocationPolicy );
+ this.returnNullWhenFull = false;
+ }
+
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/EHCacheTest.java
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/EHCacheTest.java?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/EHCacheTest.java
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/test/java/org/apache/directmemory/ehcache/EHCacheTest.java
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,103 @@
+package org.apache.directmemory.ehcache;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.IOException;
+
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EHCacheTest
+{
+
+ @Test
+ public void testPutRetreive()
+ {
+ CacheManager cacheManager = CacheManager.getInstance();
+ Ehcache ehcache = cacheManager.getEhcache( "testCache" );
+
+ ehcache.put( new Element( "testKey", "testValue" ) );
+ stats( ehcache );
+ Assert.assertEquals( "testValue", ehcache.get( "testKey"
).getObjectValue() );
+ }
+
+ @Test
+ public void testSizing()
+ {
+ CacheManager cacheManager = CacheManager.getInstance();
+ Ehcache ehcache = cacheManager.getEhcache( "testCache" );
+ for ( int i = 0; i < 30000; i++ )
+ {
+ if ( ( i % 1000 ) == 0 )
+ {
+ System.out.println( "heatbeat " + i );
+ stats( ehcache );
+ }
+ ehcache.put( new Element( i, new byte[1024] ) );
+ }
+ stats( ehcache );
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testOffHeapExceedMemory()
+ throws IOException
+ {
+ CacheManager cacheManager = CacheManager.getInstance();
+ Ehcache ehcache = cacheManager.getEhcache( "testCache" );
+ Element element = null;
+ try
+ {
+ for ( int i = 0; i < 3000000; i++ )
+ {
+ if ( ( i % 1000 ) == 0 )
+ {
+ System.out.println( "heatbeat " + i );
+ stats( ehcache );
+ }
+ element = new Element( i, new byte[1024] );
+ ehcache.put( element );
+ }
+ Assert.fail( "CacheException expected for DirectMemory OffHeap
Memory Exceeded" );
+ }
+ catch ( CacheException e )
+ {
+ stats( ehcache );
+ Assert.assertTrue( "CacheException expected for DirectMemory
OffHeap Memory Exceeded", true );
+ }
+
+ }
+
+ private void stats( Ehcache ehcache )
+ {
+ System.out.println( "OnHeapSize=" + ehcache.calculateInMemorySize() +
", OnHeapElements="
+ + ehcache.getMemoryStoreSize() );
+ System.out.println( "OffHeapSize=" + ehcache.calculateOffHeapSize() +
", OffHeapElements="
+ + ehcache.getOffHeapStoreSize() );
+ System.out.println( "DiskStoreSize=" + ehcache.calculateOnDiskSize() +
", DiskStoreElements="
+ + ehcache.getDiskStoreSize() );
+ }
+
+}
Added:
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/ehcache.xml
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/test/resources/ehcache.xml?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/ehcache.xml
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/ehcache.xml
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,31 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<ehcache>
+
+ <defaultCache />
+
+ <cache name="testCache"
+ eternal="false"
+ diskPersistent="false"
+ overflowToOffHeap="true"
+ maxElementsInMemory="30"
+ maxBytesLocalOffHeap="100M"
+ />
+
+</ehcache>
\ No newline at end of file
Added:
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/logback-test.xml
URL:
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/ehcache/src/test/resources/logback-test.xml?rev=1293567&view=auto
==============================================================================
---
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/logback-test.xml
(added)
+++
incubator/directmemory/trunk/integrations/ehcache/src/test/resources/logback-test.xml
Sat Feb 25 10:16:25 2012
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %method - %msg%n</Pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.apache.directmemory.serialization" level="warn">
+ <appender-ref ref="STDOUT"/>
+
+ </logger>
+
+ <logger name="org.apache.directmemory.measures" level="info">
+ <appender-ref ref="STDOUT"/>
+
+ </logger>
+
+ <logger name="org.apache.directmemory.memory" level="info">
+ <appender-ref ref="STDOUT"/>
+
+ </logger>
+
+ <logger name="org.apache.directmemory.cache" level="info">
+ <appender-ref ref="STDOUT"/>
+
+ </logger>
+
+ <logger name="org.apache.directmemory.ehcache" level="info">
+ <appender-ref ref="STDOUT"/>
+
+ </logger>
+
+</configuration>
\ No newline at end of file