Coherence:使用Entry Processor

时间:2017-07-31 10:02:00

标签: java oracle-coherence

我试图使用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以上时,错误消失但仍然被驱逐无效。

1 个答案:

答案 0 :(得分:0)

使用v3.7.1.16驱逐时,Coherence BackingMap中存在错误。升级到Coherence v12后,此问题已解决。

相关问题