Search in sources :

Example 1 with ResultSet

use of com.hazelcast.replicatedmap.impl.record.ResultSet in project hazelcast by hazelcast.

the class ReplicatedMapProxy method entrySet.

@Override
public Set<Entry<K, V>> entrySet() {
    Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
    List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>();
    for (ReplicatedRecordStore store : stores) {
        entries.addAll(store.entrySet(true));
    }
    return new ResultSet<K, V>(entries, IterationType.ENTRY);
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ArrayList(java.util.ArrayList) ResultSet(com.hazelcast.replicatedmap.impl.record.ResultSet)

Example 2 with ResultSet

use of com.hazelcast.replicatedmap.impl.record.ResultSet in project hazelcast by hazelcast.

the class ClientReplicatedMapProxy method keySet.

@Override
public Set<K> keySet() {
    ClientMessage request = ReplicatedMapKeySetCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request, targetPartitionId);
    ReplicatedMapKeySetCodec.ResponseParameters result = ReplicatedMapKeySetCodec.decodeResponse(response);
    List<Entry<K, V>> keys = new ArrayList<Entry<K, V>>(result.response.size());
    for (Data dataKey : result.response) {
        keys.add(new AbstractMap.SimpleImmutableEntry<K, V>((K) toObject(dataKey), null));
    }
    return new ResultSet(keys, IterationType.KEY);
}
Also used : AbstractMap(java.util.AbstractMap) ReplicatedMapKeySetCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapKeySetCodec) ArrayList(java.util.ArrayList) ResultSet(com.hazelcast.replicatedmap.impl.record.ResultSet) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 3 with ResultSet

use of com.hazelcast.replicatedmap.impl.record.ResultSet in project hazelcast by hazelcast.

the class ClientReplicatedMapProxy method entrySet.

@Override
public Set<Entry<K, V>> entrySet() {
    ClientMessage request = ReplicatedMapEntrySetCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request, targetPartitionId);
    ReplicatedMapEntrySetCodec.ResponseParameters result = ReplicatedMapEntrySetCodec.decodeResponse(response);
    List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>(result.response.size());
    for (Entry<Data, Data> dataEntry : result.response) {
        K key = toObject(dataEntry.getKey());
        V value = toObject(dataEntry.getValue());
        entries.add(new AbstractMap.SimpleImmutableEntry<K, V>(key, value));
    }
    return new ResultSet<K, V>(entries, IterationType.ENTRY);
}
Also used : ReplicatedMapEntrySetCodec(com.hazelcast.client.impl.protocol.codec.ReplicatedMapEntrySetCodec) ArrayList(java.util.ArrayList) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) AbstractMap(java.util.AbstractMap) ResultSet(com.hazelcast.replicatedmap.impl.record.ResultSet)

Aggregations

ResultSet (com.hazelcast.replicatedmap.impl.record.ResultSet)3 ArrayList (java.util.ArrayList)3 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)2 Data (com.hazelcast.nio.serialization.Data)2 AbstractMap (java.util.AbstractMap)2 ReplicatedMapEntrySetCodec (com.hazelcast.client.impl.protocol.codec.ReplicatedMapEntrySetCodec)1 ReplicatedMapKeySetCodec (com.hazelcast.client.impl.protocol.codec.ReplicatedMapKeySetCodec)1 ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)1