use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class AbstractReplicatedMapAddEntryListenerMessageTask method call.
@Override
protected Object call() {
ReplicatedMapService service = getService(ReplicatedMapService.SERVICE_NAME);
ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
String registrationId;
Predicate predicate = getPredicate();
if (predicate == null) {
registrationId = eventPublishingService.addEventListener(this, new ReplicatedEntryEventFilter(getKey()), getDistributedObjectName());
} else {
registrationId = eventPublishingService.addEventListener(this, new ReplicatedQueryEventFilter(getKey(), predicate), getDistributedObjectName());
}
endpoint.addListenerDestroyAction(ReplicatedMapService.SERVICE_NAME, getDistributedObjectName(), registrationId);
return registrationId;
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPublisherCreateMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
final InternalOperationService operationService = nodeEngine.getOperationService();
final ClientEndpoint endpoint = getEndpoint();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, false, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPublisherCreateWithValueMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
final InternalOperationService operationService = nodeEngine.getOperationService();
final ClientEndpoint endpoint = getEndpoint();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddEntryListenerWithEntryListenerAndPredicate_NullListener.
@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithEntryListenerAndPredicate_NullListener() throws Exception {
EntryListener entryListener = null;
Predicate predicate = new TruePredicate();
map.addEntryListener(entryListener, predicate, false);
}
use of com.hazelcast.query.Predicate in project hazelcast by hazelcast.
the class MapPreconditionsTest method testAddEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate.
@Test(expected = NullPointerException.class)
public void testAddEntryListenerWithMapListenerAndPredicateAndKey_NullPredicate() throws Exception {
MapListener mapListener = new MapListenerAdapter() {
public void onEntryEvent(EntryEvent event) {
System.out.println("-");
}
};
Predicate predicate = null;
map.addEntryListener(mapListener, predicate, null, true);
}
Aggregations