Managerを利用した擬似コード
36 int campaign_id = xxx; List<Integer> memberIds = [id1, id2, id3 ...]; AdvancedCache<Object, Object> memberCache = JdgUtil.lookupCache(CacheNames.MEMBER); DefaultExecutorService des = new DefaultExecutorService(memberCache); task = new DistributedMemberFilteringService(campaign_id, memberIds); des.submitEverywhere(task, memberIds) public class DistributedMemberFilteringService { public DistributedMemberFilteringService(List<Integer> memberIds) { this.campaign_id = campaign_id; this.memberIds = memberIds; } public void call() { List<Integer> localMemberIds = narrowDownToLocal(memberIds); List<Integer> offerMemberIds = new ArrayList<Integer>(); for(Integer memId : localMemberIds) { Member member = (Member)memberCache.get(memberId); MemberFilteringFact fact = new MemberFilteringFact(member); MemberFilterRule rule = new MemberFilterRule(fact); rule.fire(); if(!fact.isFiltered()) { offerMemberIds.add(memberId); } } 次の処理(offerMemberIds); } private List<Integer> narrowDownToLocal(List<Integer> memberIds) { List<Integer> localMemberIds = new ArrayList<Integer>(); AdvancedCache<Object, Object> memberCache = JdgUtil.lookupCache(CacheNames.MEMBER); JdgDistributionUtil localityChecker = new JdgDistributionUtil(memberCache); for (Integer memberId : memberIds) { if (localityChecker.isLocal(memberId)) { localMemberIds.add(memberId); } } return localMemberIds; } } memberIdsに含まれるmemberIdをkeyとして持つノード全てでtask.call()を実行 値のローカリティ判定 自ノードのキャッシュのみに絞り込み