com.bagri.server.hazelcast.predicate.CollectionPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bagri-server-hazelcast Show documentation
Show all versions of bagri-server-hazelcast Show documentation
Bagri DB Cache: Hazelcast implementation
The newest version!
package com.bagri.server.hazelcast.predicate;
import static com.bagri.server.hazelcast.serialize.SystemSerializationFactory.cli_CollectionPredicate;
import static com.bagri.server.hazelcast.serialize.SystemSerializationFactory.cli_factory_id;
import java.io.IOException;
import java.util.Map.Entry;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import com.bagri.core.DocumentKey;
import com.bagri.core.model.Document;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.query.Predicate;
public class CollectionPredicate implements Predicate, IdentifiedDataSerializable {
//private static final transient Logger logger = LoggerFactory.getLogger(CollectionPredicate.class);
/**
*
*/
private static final long serialVersionUID = 1L;
private int clnId;
public CollectionPredicate() {
// for de-serialization
//logger.trace("");
}
public CollectionPredicate(int clnId) {
this.clnId = clnId;
//logger.trace("; clnId: {}", clnId);
}
@Override
public int getFactoryId() {
return cli_factory_id;
}
@Override
public int getId() {
return cli_CollectionPredicate;
}
@Override
public boolean apply(Entry docEntry) {
Document doc = docEntry.getValue();
// will perform this check later anyway..
//logger.info("apply; doc: {}", doc);
return doc.hasCollection(clnId); // && doc.getTxFinish() == 0;
}
@Override
public void readData(ObjectDataInput in) throws IOException {
clnId = in.readInt();
//logger.info("read; clnId: {}", clnId);
}
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeInt(clnId);
//logger.info("write; clnId: {}", clnId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy