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

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

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

import java.util.Map;
import java.util.Set;

import com.hazelcast.core.PartitionService;
import com.hazelcast.query.Predicate;

public class PartitionPredicate implements Predicate {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private PartitionService partService;
	private Set partitions;
	private Predicate predicate;
	
	public PartitionPredicate() {
		//
	}
	
	public PartitionPredicate(PartitionService partService, Set partitions, Predicate predicate) {
		this.partService = partService;
		this.partitions = partitions;
		this.predicate = predicate;
	}

	@Override
	public boolean apply(Map.Entry mapEntry) {
		if (partitions.contains(partService.getPartition(mapEntry.getKey()).getPartitionId())) {
			return predicate.apply(mapEntry);
		}
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy