【发布时间】:2014-07-14 21:05:36
【问题描述】:
我正在使用 Hazelcast 3.2.3(点对点模式 - 但目前在一个节点上进行测试)。
我已通过 XML 配置文件将以下商店加载实现附加到地图:
<map-store enabled="true">
<class-name>test.TestStoreLoadImpl</class-name>
<write-delay-seconds>0</write-delay-seconds>
</map-store>
但是,当调用存储加载时,似乎为接收到的键集合中的每个值调用加载全部,即如果集合有 5 个整数,加载全部被调用 5 次(而不是被调用一次然后我应该遍历集合以获取适当的值,将它们添加到哈希图中并返回)。知道我做错了什么吗?
//public class TestStoreLoad implements MapStore<Integer, Test>, MapLoader<Integer, Test>, MapLoaderLifecycleSupport {
public class TestStoreLoad implements MapStore<Integer, Test>, MapLoader<Integer, Test> {
//returns 5 keys in one collection
@Override
public Set<Integer> loadAllKeys()
//however the load all gets called 5 times instead of 1
@Override
public Map<Integer, Test> loadAll(Collection<Integer> keys) {
Logger.info("load all called");
当我使用来自池的数据库连接时,这似乎给我带来了问题(没有任何延迟)。现在我需要显着增加连接池大小或在我的存储负载中引入时间延迟,因为我的连接池无法处理连接请求的数量(一旦我完成操作,我将释放连接回池在商店加载)。
【问题讨论】: