use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.
the class TxnRemoveBackupOperation method run.
@Override
public void run() throws Exception {
MultiMapContainer container = getOrCreateContainer();
MultiMapValue multiMapValue = container.getMultiMapValueOrNull(dataKey);
response = true;
if (multiMapValue == null || !multiMapValue.containsRecordId(recordId)) {
response = false;
return;
}
Collection<MultiMapRecord> coll = multiMapValue.getCollection(false);
Iterator<MultiMapRecord> iter = coll.iterator();
while (iter.hasNext()) {
if (iter.next().getRecordId() == recordId) {
iter.remove();
break;
}
}
if (coll.isEmpty()) {
delete();
}
}
use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.
the class TxnRemoveOperation method run.
@Override
public void run() throws Exception {
begin = Clock.currentTimeMillis();
MultiMapContainer container = getOrCreateContainer();
MultiMapValue multiMapValue = container.getMultiMapValueOrNull(dataKey);
response = true;
if (multiMapValue == null || !multiMapValue.containsRecordId(recordId)) {
response = false;
return;
}
Collection<MultiMapRecord> coll = multiMapValue.getCollection(false);
Iterator<MultiMapRecord> iter = coll.iterator();
while (iter.hasNext()) {
if (iter.next().getRecordId() == recordId) {
iter.remove();
break;
}
}
if (coll.isEmpty()) {
delete();
}
}
use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.
the class MultiMapRemoveMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
MultiMapResponse multiMapResponse = (MultiMapResponse) response;
Collection<MultiMapRecord> collection = multiMapResponse.getCollection();
List<Data> resultCollection = new ArrayList<Data>(collection.size());
for (MultiMapRecord multiMapRecord : collection) {
resultCollection.add(serializationService.toData(multiMapRecord.getObject()));
}
return MultiMapRemoveCodec.encodeResponse(resultCollection);
}
use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.
the class TransactionalMultiMapProxy method remove.
@Override
public Collection<V> remove(Object key) {
checkTransactionActive();
Data dataKey = getNodeEngine().toData(key);
Collection<MultiMapRecord> coll = removeAllInternal(dataKey);
Collection<V> result = new ArrayList<V>(coll.size());
for (MultiMapRecord record : coll) {
result.add((V) toObjectIfNeeded(record.getObject()));
}
return result;
}
use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.
the class MultiMapGetMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
List<Data> collection = new ArrayList<Data>();
Collection<MultiMapRecord> responseCollection = ((MultiMapResponse) response).getCollection();
if (responseCollection != null) {
for (MultiMapRecord record : responseCollection) {
collection.add(serializationService.toData(record.getObject()));
}
}
return MultiMapGetCodec.encodeResponse(collection);
}
Aggregations