use of com.hazelcast.multimap.impl.MultiMapContainer in project hazelcast by hazelcast.
the class RemoveAllOperation method onWaitExpire.
@Override
public void onWaitExpire() {
MultiMapContainer container = getOrCreateContainer();
MultiMapConfig.ValueCollectionType valueCollectionType = getValueCollectionType(container);
sendResponse(new MultiMapResponse(null, valueCollectionType));
}
use of com.hazelcast.multimap.impl.MultiMapContainer in project hazelcast by hazelcast.
the class TxnRemoveAllBackupOperation method run.
@Override
public void run() throws Exception {
MultiMapContainer container = getOrCreateContainer();
MultiMapValue multiMapValue = container.getOrCreateMultiMapValue(dataKey);
response = true;
for (Long recordId : recordIds) {
if (!multiMapValue.containsRecordId(recordId)) {
response = false;
return;
}
}
Collection<MultiMapRecord> coll = multiMapValue.getCollection(false);
for (Long recordId : recordIds) {
Iterator<MultiMapRecord> iter = coll.iterator();
while (iter.hasNext()) {
MultiMapRecord record = iter.next();
if (record.getRecordId() == recordId) {
iter.remove();
break;
}
}
}
if (coll.isEmpty()) {
delete();
}
}
use of com.hazelcast.multimap.impl.MultiMapContainer in project hazelcast by hazelcast.
the class TxnRemoveAllOperation method run.
@Override
public void run() throws Exception {
begin = Clock.currentTimeMillis();
MultiMapContainer container = getOrCreateContainer();
MultiMapValue multiMapValue = container.getOrCreateMultiMapValue(dataKey);
response = true;
for (Long recordId : recordIds) {
if (!multiMapValue.containsRecordId(recordId)) {
response = false;
return;
}
}
Collection<MultiMapRecord> coll = multiMapValue.getCollection(false);
removed = new LinkedList<MultiMapRecord>();
for (Long recordId : recordIds) {
Iterator<MultiMapRecord> iter = coll.iterator();
while (iter.hasNext()) {
MultiMapRecord record = iter.next();
if (record.getRecordId() == recordId) {
iter.remove();
removed.add(record);
break;
}
}
}
if (coll.isEmpty()) {
delete();
}
}
use of com.hazelcast.multimap.impl.MultiMapContainer in project hazelcast by hazelcast.
the class TxnLockAndGetOperation method run.
@Override
public void run() throws Exception {
MultiMapContainer container = getOrCreateContainer();
if (!container.txnLock(dataKey, getCallerUuid(), threadId, getCallId(), ttl, blockReads)) {
throw new TransactionException("Transaction couldn't obtain lock!");
}
MultiMapValue multiMapValue = getMultiMapValueOrNull();
boolean isLocal = executedLocally();
Collection<MultiMapRecord> collection = multiMapValue == null ? null : multiMapValue.getCollection(isLocal);
MultiMapResponse multiMapResponse = new MultiMapResponse(collection, getValueCollectionType(container));
multiMapResponse.setNextRecordId(container.nextId());
response = multiMapResponse;
}
use of com.hazelcast.multimap.impl.MultiMapContainer in project hazelcast by hazelcast.
the class TxnPrepareOperation method run.
@Override
public void run() throws Exception {
MultiMapContainer container = getOrCreateContainer();
if (!container.extendLock(dataKey, getCallerUuid(), threadId, LOCK_EXTENSION_TIME_IN_MILLIS)) {
throw new TransactionException("Lock is not owned by the transaction! -> " + container.getLockOwnerInfo(dataKey));
}
response = true;
}
Aggregations