use of com.hazelcast.map.impl.querycache.InvokerWrapper in project hazelcast by hazelcast.
the class ClientQueryCacheEndToEndConstructor method createPublishAccumulatorWithIncludeValue.
private void createPublishAccumulatorWithIncludeValue(AccumulatorInfo info) {
Data data = context.getSerializationService().toData(info.getPredicate());
ClientMessage request = ContinuousQueryPublisherCreateWithValueCodec.encodeRequest(info.getMapName(), info.getCacheName(), data, info.getBatchSize(), info.getBufferSize(), info.getDelaySeconds(), info.isPopulate(), info.isCoalesce());
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
ClientMessage response = (ClientMessage) invokerWrapper.invoke(request);
Collection<Map.Entry<Data, Data>> result = ContinuousQueryPublisherCreateWithValueCodec.decodeResponse(response).response;
populateWithValues(queryCache, result);
}
use of com.hazelcast.map.impl.querycache.InvokerWrapper in project hazelcast by hazelcast.
the class DefaultQueryCache method isTryRecoverSucceeded.
/**
* This tries to reset cursor position of the accumulator to the supplied sequence,
* if that sequence is still there, it will be succeeded, otherwise query cache content stays inconsistent.
*/
private boolean isTryRecoverSucceeded(ConcurrentMap<Integer, Long> brokenSequences) {
int numberOfBrokenSequences = brokenSequences.size();
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
SubscriberContext subscriberContext = context.getSubscriberContext();
SubscriberContextSupport subscriberContextSupport = subscriberContext.getSubscriberContextSupport();
List<Future<Object>> futures = new ArrayList<Future<Object>>(numberOfBrokenSequences);
for (Map.Entry<Integer, Long> entry : brokenSequences.entrySet()) {
Integer partitionId = entry.getKey();
Long sequence = entry.getValue();
Object recoveryOperation = subscriberContextSupport.createRecoveryOperation(mapName, cacheName, sequence, partitionId);
Future<Object> future = (Future<Object>) invokerWrapper.invokeOnPartitionOwner(recoveryOperation, partitionId);
futures.add(future);
}
Collection<Object> results = FutureUtil.returnWithDeadline(futures, 1, MINUTES);
int successCount = 0;
for (Object object : results) {
Boolean resolvedResponse = subscriberContextSupport.resolveResponseForRecoveryOperation(object);
if (TRUE.equals(resolvedResponse)) {
successCount++;
}
}
return successCount == numberOfBrokenSequences;
}
use of com.hazelcast.map.impl.querycache.InvokerWrapper in project hazelcast by hazelcast.
the class NodeQueryCacheEndToEndConstructor method createPublishersAndGetQueryResults.
private Collection<QueryResult> createPublishersAndGetQueryResults(AccumulatorInfo info) {
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
Collection<Member> members = context.getMemberList();
List<Future<QueryResult>> futures = new ArrayList<Future<QueryResult>>(members.size());
for (Member member : members) {
Address address = member.getAddress();
Future future = invokerWrapper.invokeOnTarget(new PublisherCreateOperation(info), address);
futures.add(future);
}
return returnWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
use of com.hazelcast.map.impl.querycache.InvokerWrapper in project hazelcast by hazelcast.
the class NodeQueryCacheEndToEndConstructor method madePublishable.
private void madePublishable(String mapName, String cacheName) throws Exception {
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
Collection<Member> memberList = context.getMemberList();
List<Future> futures = new ArrayList<Future>(memberList.size());
for (Member member : memberList) {
Operation operation = new MadePublishableOperation(mapName, cacheName);
Future future = invokerWrapper.invokeOnTarget(operation, member.getAddress());
futures.add(future);
}
waitWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
use of com.hazelcast.map.impl.querycache.InvokerWrapper in project hazelcast by hazelcast.
the class ClientQueryCacheEndToEndConstructor method createPublishAccumulatorWithoutIncludeValue.
private void createPublishAccumulatorWithoutIncludeValue(AccumulatorInfo info) {
Data data = context.getSerializationService().toData(info.getPredicate());
ClientMessage request = ContinuousQueryPublisherCreateCodec.encodeRequest(info.getMapName(), info.getCacheName(), data, info.getBatchSize(), info.getBufferSize(), info.getDelaySeconds(), info.isPopulate(), info.isCoalesce());
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
ClientMessage response = (ClientMessage) invokerWrapper.invoke(request);
Collection<Data> result = ContinuousQueryPublisherCreateCodec.decodeResponse(response).response;
populateWithoutValues(queryCache, result);
}
Aggregations