Search in sources :

Example 1 with CacheEntriesWithCursor

use of com.hazelcast.cache.impl.CacheEntriesWithCursor 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());
}
Also used : CacheEntriesWithCursor(com.hazelcast.cache.impl.CacheEntriesWithCursor) IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 2 with CacheEntriesWithCursor

use of com.hazelcast.cache.impl.CacheEntriesWithCursor 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);
}
Also used : ArrayList(java.util.ArrayList) Data(com.hazelcast.internal.serialization.Data) AbstractMap(java.util.AbstractMap) IterationPointer(com.hazelcast.internal.iteration.IterationPointer) CacheEntriesWithCursor(com.hazelcast.cache.impl.CacheEntriesWithCursor) SampleableConcurrentHashMap(com.hazelcast.internal.util.SampleableConcurrentHashMap) AbstractMap(java.util.AbstractMap) Map(java.util.Map)

Aggregations

CacheEntriesWithCursor (com.hazelcast.cache.impl.CacheEntriesWithCursor)2 IterationPointer (com.hazelcast.internal.iteration.IterationPointer)2 Data (com.hazelcast.internal.serialization.Data)1 SampleableConcurrentHashMap (com.hazelcast.internal.util.SampleableConcurrentHashMap)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1