use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheIterateEntriesMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
if (response == null) {
return CacheIterateEntriesCodec.encodeResponse(Collections.emptyList(), Collections.emptyList());
}
CacheEntriesWithCursor iteratorResult = (CacheEntriesWithCursor) response;
IterationPointer[] pointers = iteratorResult.getPointers();
return CacheIterateEntriesCodec.encodeResponse(encodePointers(pointers), iteratorResult.getEntries());
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class ClientMapQueryPartitionIterator method fetch.
@Override
protected List<Data> fetch() {
HazelcastClientInstanceImpl client = (HazelcastClientInstanceImpl) context.getHazelcastInstance();
ClientMessage request = MapFetchWithQueryCodec.encodeRequest(mapProxy.getName(), encodePointers(pointers), fetchSize, getSerializationService().toData(query.getProjection()), getSerializationService().toData(query.getPredicate()));
ClientInvocation clientInvocation = new ClientInvocation(client, request, mapProxy.getName(), partitionId);
try {
ClientInvocationFuture f = clientInvocation.invoke();
MapFetchWithQueryCodec.ResponseParameters responseParameters = MapFetchWithQueryCodec.decodeResponse(f.get());
List<Data> results = responseParameters.results;
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setLastTableIndex(results, pointers);
return results;
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class ClientMapPartitionIterator method fetchWithPrefetchValues.
private List fetchWithPrefetchValues(HazelcastClientInstanceImpl client) {
ClientMessage request = MapFetchEntriesCodec.encodeRequest(mapProxy.getName(), encodePointers(pointers), fetchSize);
ClientInvocation clientInvocation = new ClientInvocation(client, request, mapProxy.getName(), partitionId);
try {
ClientInvocationFuture f = clientInvocation.invoke();
MapFetchEntriesCodec.ResponseParameters responseParameters = MapFetchEntriesCodec.decodeResponse(f.get());
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setIterationPointers(responseParameters.entries, pointers);
return responseParameters.entries;
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheKeysWithCursor method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeInt(pointers.length);
for (IterationPointer pointer : pointers) {
out.writeInt(pointer.getIndex());
out.writeInt(pointer.getSize());
}
int size = keys.size();
out.writeInt(size);
for (Data o : keys) {
IOUtil.writeData(out, o);
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheKeysWithCursor method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
int pointersCount = in.readInt();
pointers = new IterationPointer[pointersCount];
for (int i = 0; i < pointersCount; i++) {
pointers[i] = new IterationPointer(in.readInt(), in.readInt());
}
int size = in.readInt();
keys = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
Data data = IOUtil.readData(in);
keys.add(data);
}
}
Aggregations