use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class QueueStoreWrapper method loadAll.
@Override
public Map<Long, Data> loadAll(Collection<Long> keys) {
if (!enabled) {
return null;
}
final Map<Long, ?> map = store.loadAll(keys);
if (map == null) {
return Collections.emptyMap();
}
final Map<Long, Data> dataMap = new HashMap<Long, Data>(map.size());
if (binary) {
for (Map.Entry<Long, ?> entry : map.entrySet()) {
byte[] dataBuffer = (byte[]) entry.getValue();
Data data = new HeapData(Arrays.copyOf(dataBuffer, dataBuffer.length));
dataMap.put(entry.getKey(), data);
}
} else {
for (Map.Entry<Long, ?> entry : map.entrySet()) {
dataMap.put(entry.getKey(), serializationService.toData(entry.getValue()));
}
}
return dataMap;
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class AddAllBackupOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(dataMap.size());
for (Map.Entry<Long, Data> entry : dataMap.entrySet()) {
long itemId = entry.getKey();
Data value = entry.getValue();
out.writeLong(itemId);
out.writeData(value);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class AddAllOperation method afterRun.
@Override
public void afterRun() throws Exception {
LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
stats.incrementOtherOperations();
if (Boolean.TRUE.equals(response)) {
for (Data data : dataList) {
publishEvent(ItemEventType.ADDED, data);
}
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class ClearOperation method afterRun.
@Override
public void afterRun() throws Exception {
LocalQueueStatsImpl stats = getQueueService().getLocalQueueStatsImpl(name);
stats.incrementOtherOperations();
for (Data data : dataMap.values()) {
publishEvent(ItemEventType.REMOVED, data);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class CompareAndRemoveOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeBoolean(retain);
out.writeInt(dataList.size());
for (Data data : dataList) {
out.writeData(data);
}
}
Aggregations