public void run() throws Exception {
   MultiMapContainer container = getOrCreateContainer();
   if (!container.txnLock(dataKey, caller, threadId, ttl + LOCK_EXTENSION_TIME_IN_MILLIS)) {
     throw new TransactionException(
         "Lock is not owned by the transaction! -> " + container.getLockOwnerInfo(dataKey));
   }
 }
Пример #2
0
 @Override
 public void run() throws Exception {
   begin = Clock.currentTimeMillis();
   MultiMapContainer container = getOrCreateContainer();
   MultiMapValue multiMapValue = container.getOrCreateMultiMapValue(dataKey);
   response = true;
   if (multiMapValue.containsRecordId(recordId)) {
     response = false;
     return;
   }
   Collection<MultiMapRecord> coll = multiMapValue.getCollection(false);
   MultiMapRecord record = new MultiMapRecord(recordId, isBinary() ? value : toObject(value));
   coll.add(record);
 }
Пример #3
0
 public void run() throws Exception {
   MultiMapContainer container = getOrCreateContainer();
   recordId = container.nextId();
   MultiMapRecord record = new MultiMapRecord(recordId, isBinary() ? value : toObject(value));
   Collection<MultiMapRecord> coll =
       container.getOrCreateMultiMapWrapper(dataKey).getCollection(false);
   if (index == -1) {
     response = coll.add(record);
   } else {
     try {
       ((List<MultiMapRecord>) coll).add(index, record);
       response = true;
     } catch (IndexOutOfBoundsException e) {
       response = e;
     }
   }
 }
 @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();
   }
 }
Пример #5
0
 @Override
 public void run() throws Exception {
   MultiMapContainer container = getOrCreateContainer();
   ((MultiMapService) getService()).getLocalMultiMapStatsImpl(name).incrementOtherOperations();
   response = new MultiMapResponse(container.keySet(), getValueCollectionType(container));
 }