[infinispan-issues] [JBoss JIRA] Commented: (ISPN-864) Passivate in-memory entries to cache store upon shutdown
Dave Marion (JIRA)
jira-events at lists.jboss.org
Wed Jan 5 20:37:17 EST 2011
[ https://issues.jboss.org/browse/ISPN-864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573652#comment-12573652 ]
Dave Marion commented on ISPN-864:
----------------------------------
Test case, uncommenting the commented code makes the test work.
-----
import java.io.File;
import java.io.FileWriter;
import junit.framework.TestCase;
import org.infinispan.Cache;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
public class PassiviationTest extends TestCase {
File configFile = null;
String configuration =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"+
"<infinispan xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd\" xmlns=\"urn:infinispan:config:4.0\">\n"+
"<namedCache name=\"persistentCache\">\n"+
"<eviction wakeUpInterval=\"500\" maxEntries=\"5000\" strategy=\"LIRS\" threadPolicy=\"PIGGYBACK\" />\n"+
"<expiration lifespan=\"60000\" maxIdle=\"1000\" />\n"+
"<loaders passivation=\"true\" shared=\"true\" preload=\"true\">\n"+
"<loader class=\"org.infinispan.loaders.file.FileCacheStore\" fetchPersistentState=\"false\" ignoreModifications=\"false\" purgeOnStartup=\"false\">\n"+
"<properties>\n"+
"<property name=\"location\" value=\"${java.io.tmpdir}\" />\n"+
"</properties>\n"+
"</loader>\n"+
"</loaders>\n"+
"</namedCache>\n"+
"</infinispan>\n";
public void setUp() throws Exception {
configFile = File.createTempFile("config", ".xml");
FileWriter writer = new FileWriter(configFile);
writer.write(configuration);
writer.close();
}
public void testPassivation() throws Exception {
EmbeddedCacheManager manager = new DefaultCacheManager(configFile.getAbsolutePath());
Cache<String,String> data = manager.getCache("persistentCache");
data.clear();
data.put("First", "One");
data.put("Second", "Two");
// If these two lines are uncommented, then the test works.
// data.evict("First");
// data.evict("Second");
data.stop();
manager.stop();
manager = new DefaultCacheManager(configFile.getAbsolutePath());
data = manager.getCache("persistentCache");
assertEquals(2, data.size());
assertTrue(data.get("First").equals("One"));
assertTrue(data.get("Second").equals("Two"));
data.stop();
manager.stop();
}
}
> Passivate in-memory entries to cache store upon shutdown
> --------------------------------------------------------
>
> Key: ISPN-864
> URL: https://issues.jboss.org/browse/ISPN-864
> Project: Infinispan
> Issue Type: Feature Request
> Components: Loaders and Stores
> Affects Versions: 4.2.0.Final
> Reporter: Dave Marion
> Assignee: Manik Surtani
> Labels: passivation, shutdown
>
> When cache store configured, passivate in-memory entries when cache is shutdown.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list