]
Alan Field updated ISPN-4583:
-----------------------------
Attachment: repl-udp-no-tx-leveldb-jni.xml
Cache configuration file with LevelDB cache store
Distributed iterator throws ClassCastException when LevelDB cache
store contains passivated entries
---------------------------------------------------------------------------------------------------
Key: ISPN-4583
URL:
https://issues.jboss.org/browse/ISPN-4583
Project: Infinispan
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Core
Affects Versions: 7.0.0.Alpha5
Reporter: Alan Field
Assignee: Dan Berindei
Attachments: repl-udp-no-tx-leveldb-jni.xml
This code will iterate over all of the entries in a cache to get the total size:
{code:java}
public int getTotalSize() {
log.info(getClass().getName() + ".getTotalSize() for cache " +
cache.getName());
int totalSize = 0;
EntryIterable entryIterator = null;
try {
entryIterator = cache.filterEntries(new AllEntriesFilter());
CloseableIterable ci = entryIterator.converter(new AllEntriesConverter());
Iterator iter = ci.iterator();
while (iter.hasNext()) {
iter.next();
totalSize++;
}
return totalSize;
} finally {
if (entryIterator != null) {
try {
entryIterator.close();
} catch (Exception e) {
log.error("Failed to close EntryIterable", e);
}
}
}
}
{code}
I wanted to verify that this code would also work when I was using passivation and a
cachestore. The repl-udp-no-tx-leveldb-jni.xml file defines the configuration that I am
using. I run a test that puts random data into the cache then checks the size of the
cache, but I am getting a bunch of ClassCastException exceptions during the iteration:
{noformat}
java.lang.ClassCastException: java.lang.String cannot be cast to
org.infinispan.container.entries.InternalCacheEntry
at
org.infinispan.iteration.impl.LocalEntryRetriever$MapAction.apply(LocalEntryRetriever.java:251)
at
org.infinispan.iteration.impl.LocalEntryRetriever$KeyValueActionForCacheLoaderTask.processEntry(LocalEntryRetriever.java:154)
at org.infinispan.persistence.leveldb.LevelDBStore$1.call(LevelDBStore.java:297)
at org.infinispan.persistence.leveldb.LevelDBStore$1.call(LevelDBStore.java:285)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
org.infinispan.util.concurrent.WithinThreadExecutor.execute(WithinThreadExecutor.java:22)
at
java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
at
org.infinispan.executors.ExecutorAllCompletionService.submit(ExecutorAllCompletionService.java:31)
at
org.infinispan.persistence.leveldb.LevelDBStore.submitProcessTask(LevelDBStore.java:285)
at
org.infinispan.persistence.leveldb.LevelDBStore.process(LevelDBStore.java:260)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.processOnAllStores(PersistenceManagerImpl.java:438)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.processOnAllStores(PersistenceManagerImpl.java:420)
at
org.infinispan.iteration.impl.LocalEntryRetriever$1.run(LocalEntryRetriever.java:217)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
{noformat}