use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheFetchEntriesOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(pointers.length);
for (IterationPointer pointer : pointers) {
out.writeInt(pointer.getIndex());
out.writeInt(pointer.getSize());
}
out.writeInt(fetchSize);
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheFetchKeysOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
int pointersCount = in.readInt();
pointers = new IterationPointer[pointersCount];
for (int i = 0; i < pointersCount; i++) {
pointers[i] = new IterationPointer(in.readInt(), in.readInt());
}
fetchSize = in.readInt();
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class ClientCacheIterator method fetch.
protected List fetch() {
HazelcastClientInstanceImpl client = (HazelcastClientInstanceImpl) context.getHazelcastInstance();
String name = cacheProxy.getPrefixedName();
if (prefetchValues) {
ClientMessage request = CacheIterateEntriesCodec.encodeRequest(name, encodePointers(pointers), fetchSize);
try {
ClientInvocation clientInvocation = new ClientInvocation(client, request, name, partitionIndex);
ClientInvocationFuture future = clientInvocation.invoke();
CacheIterateEntriesCodec.ResponseParameters responseParameters = CacheIterateEntriesCodec.decodeResponse(future.get());
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setIterationPointers(responseParameters.entries, pointers);
return responseParameters.entries;
} catch (Exception e) {
throw rethrow(e);
}
} else {
ClientMessage request = CacheIterateCodec.encodeRequest(name, encodePointers(pointers), fetchSize);
try {
ClientInvocation clientInvocation = new ClientInvocation(client, request, name, partitionIndex);
ClientInvocationFuture future = clientInvocation.invoke();
CacheIterateCodec.ResponseParameters responseParameters = CacheIterateCodec.decodeResponse(future.get());
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setIterationPointers(responseParameters.keys, pointers);
return responseParameters.keys;
} catch (Exception e) {
throw rethrow(e);
}
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheRecordHashMap method fetchEntries.
@Override
public CacheEntriesWithCursor fetchEntries(IterationPointer[] pointers, int size) {
List<Map.Entry<Data, CacheRecord>> entries = new ArrayList<>(size);
IterationPointer[] newIterationPointers = fetchEntries(pointers, size, entries);
List<Map.Entry<Data, Data>> entriesData = new ArrayList<>(entries.size());
for (Map.Entry<Data, CacheRecord> entry : entries) {
CacheRecord record = entry.getValue();
Data dataValue = serializationService.toData(record.getValue());
entriesData.add(new AbstractMap.SimpleEntry<>(entry.getKey(), dataValue));
}
return new CacheEntriesWithCursor(entriesData, newIterationPointers);
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheIterateMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
if (response == null) {
return CacheIterateCodec.encodeResponse(Collections.emptyList(), Collections.emptyList());
}
CacheKeysWithCursor keyIteratorResult = (CacheKeysWithCursor) response;
IterationPointer[] pointers = keyIteratorResult.getPointers();
return CacheIterateCodec.encodeResponse(encodePointers(pointers), keyIteratorResult.getKeys());
}
Aggregations