我试图使用EvictProcessor
逐出缓存密钥,有人知道这个错误意味着什么吗?我在使用Coherence 3.7
时遇到此错误,而此代码正在使用Coherence 3.5
。
错误:
The internal map of a ReadWriteBackingMap has an unexpected EvictionApprover; custom maps should accept and use the supplied approver
public class EvictProcessor extends AbstractProcessor implements
ExternalizableLite, PortableObject {
static ValueExtractor s_extractorMap = new ReflectionExtractor("getMap");
static ValueExtractor s_extractorKey = new ReflectionExtractor("getBinaryKey");
public EvictProcessor() {
}
public Object process(com.tangosol.util.InvocableMap.Entry entry) {
if (entry.isPresent())
{
final ReadWriteBackingMap bm = (ReadWriteBackingMap) s_extractorMap.extract(entry);
final ConfigurableCacheMap local = (ConfigurableCacheMap) bm.getInternalCache();
local.evict(s_extractorKey.extract(entry));
}
return null
}
public void readExternal(PofReader pofreader) throws IOException {}
public void writeExternal(PofWriter pofwriter) throws IOException {}
}
然后我使用上面的EvictProcessor
来驱逐缓存中的条目。
cache.invoke(key,new EvictProcessor ());
当我将Coherence升级到3.7.1.16
以上时,错误消失但仍然被驱逐无效。
答案 0 :(得分:0)
使用v3.7.1.16
驱逐时,Coherence BackingMap
中存在错误。升级到Coherence v12
后,此问题已解决。