private void putToRecord(BaseTxnQueueOperation operation) { QueueTransactionLogRecord logRecord = (QueueTransactionLogRecord) tx.get(name); if (logRecord == null) { logRecord = new QueueTransactionLogRecord(tx.getTxnId(), name, partitionId); tx.add(logRecord); } logRecord.addOperation(operation); }
private void removeFromRecord(long itemId) { QueueTransactionLogRecord logRecord = (QueueTransactionLogRecord) tx.get(name); int size = logRecord.removeOperation(itemId); if (size == 0) { tx.remove(name); } }
Collection<MultiMapRecord> removeAllInternal(Data key) { checkObjectNotNull(key); long timeout = tx.getTimeoutMillis(); long ttl = extendTimeout(timeout); Collection<MultiMapRecord> coll = txMap.get(key); MultiMapTransactionLogRecord logRecord; if (coll == null) { MultiMapResponse response = lockAndGet(key, timeout, ttl); if (response == null) { throw new ConcurrentModificationException("Transaction couldn't obtain lock " + getThreadId()); } coll = createCollection(response.getRecordCollection(getNodeEngine())); logRecord = new MultiMapTransactionLogRecord(getPartitionId(key), key, name, ttl, getThreadId()); tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key)); } txMap.put(key, createCollection()); TxnRemoveAllOperation operation = new TxnRemoveAllOperation(name, key, coll); logRecord.addOperation(operation); return coll; }
Collection<MultiMapRecord> removeAllInternal(Data key) { checkObjectNotNull(key); long timeout = tx.getTimeoutMillis(); long ttl = extendTimeout(timeout); Collection<MultiMapRecord> coll = txMap.get(key); MultiMapTransactionLogRecord logRecord; if (coll == null) { MultiMapResponse response = lockAndGet(key, timeout, ttl); if (response == null) { throw new ConcurrentModificationException("Transaction couldn't obtain lock " + getThreadId()); } coll = createCollection(response.getRecordCollection(getNodeEngine())); logRecord = new MultiMapTransactionLogRecord(getPartitionId(key), key, name, ttl, getThreadId()); tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key)); } txMap.put(key, createCollection()); TxnRemoveAllOperation operation = new TxnRemoveAllOperation(name, key, coll); logRecord.addOperation(operation); return coll; }
private void putToRecord(BaseTxnQueueOperation operation) { QueueTransactionLogRecord logRecord = (QueueTransactionLogRecord) tx.get(name); if (logRecord == null) { logRecord = new QueueTransactionLogRecord(tx.getTxnId(), name, partitionId); tx.add(logRecord); } logRecord.addOperation(operation); }
private void removeFromRecord(long itemId) { CollectionTransactionLogRecord logRecord = (CollectionTransactionLogRecord) tx.get(name); int size = logRecord.removeOperation(itemId); if (size == 0) { tx.remove(name); } }
tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key));
protected void putToRecord(CollectionTxnOperation operation) { CollectionTransactionLogRecord logRecord = (CollectionTransactionLogRecord) tx.get(name); if (logRecord == null) { logRecord = new CollectionTransactionLogRecord(getServiceName(), tx.getTxnId(), name, partitionId); tx.add(logRecord); } logRecord.addOperation(operation); }
private void removeFromRecord(long itemId) { CollectionTransactionLogRecord logRecord = (CollectionTransactionLogRecord) tx.get(name); int size = logRecord.removeOperation(itemId); if (size == 0) { tx.remove(name); } }
tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key));
protected void putToRecord(CollectionTxnOperation operation) { CollectionTransactionLogRecord logRecord = (CollectionTransactionLogRecord) tx.get(name); if (logRecord == null) { logRecord = new CollectionTransactionLogRecord(getServiceName(), tx.getTxnId(), name, partitionId); tx.add(logRecord); } logRecord.addOperation(operation); }
private void removeFromRecord(long itemId) { QueueTransactionLogRecord logRecord = (QueueTransactionLogRecord) tx.get(name); int size = logRecord.removeOperation(itemId); if (size == 0) { tx.remove(name); } }
tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key));
@Override public int size() { checkTransactionActive(); try { Map<Integer, Object> results = operationService.invokeOnAllPartitions(MultiMapService.SERVICE_NAME, new MultiMapOperationFactory(name, MultiMapOperationFactory.OperationFactoryType.SIZE)); int size = 0; for (Object obj : results.values()) { if (obj == null) { continue; } Integer result = getNodeEngine().toObject(obj); size += result; } for (Data key : txMap.keySet()) { MultiMapTransactionLogRecord log = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key)); if (log != null) { size += log.size(); } } return size; } catch (Throwable t) { throw rethrow(t); } }
tx.add(logRecord); } else { logRecord = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key));
@Override public int size() { checkTransactionActive(); try { Map<Integer, Object> results = operationService.invokeOnAllPartitions(MultiMapService.SERVICE_NAME, new MultiMapOperationFactory(name, MultiMapOperationFactory.OperationFactoryType.SIZE)); int size = 0; for (Object obj : results.values()) { if (obj == null) { continue; } Integer result = getNodeEngine().toObject(obj); size += result; } for (Data key : txMap.keySet()) { MultiMapTransactionLogRecord log = (MultiMapTransactionLogRecord) tx.get(getRecordLogKey(key)); if (log != null) { size += log.size(); } } return size; } catch (Throwable t) { throw rethrow(t); } }