All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bagri.server.hazelcast.predicate.MemberPredicate Maven / Gradle / Ivy

The newest version!
package com.bagri.server.hazelcast.predicate;

import java.util.Map;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.Member;
import com.hazelcast.core.Partition;
import com.hazelcast.core.PartitionService;
import com.hazelcast.query.Predicate;

public class MemberPredicate implements Predicate {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private PartitionService partService;
	private Member member;
	private Predicate predicate;
	
	public MemberPredicate() {
		//
	}
	
	public MemberPredicate(PartitionService partService, Member member, Predicate predicate) {
		this.partService = partService;
		this.member = member;
		this.predicate = predicate;
	}

	@Override
	public boolean apply(Map.Entry mapEntry) {
		if (member.equals(partService.getPartition(mapEntry.getKey()).getOwner())) {
			return predicate.apply(mapEntry);
		}
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy