private void addTransactionRecords(ClusterStateChange stateChange, Transaction tx, Collection<MemberImpl> members, int memberListVersion, int partitionStateVersion, boolean isTransient) { long leaseTime = Math.min(tx.getTimeoutMillis(), LOCK_LEASE_EXTENSION_MILLIS); for (Member member : members) { tx.add(new ClusterStateTransactionLogRecord(stateChange, node.getThisAddress(), member.getAddress(), tx.getTxnId(), leaseTime, memberListVersion, partitionStateVersion, isTransient)); } }
private void addTransactionRecords(ClusterStateChange stateChange, Transaction tx, Collection<MemberImpl> members, int memberListVersion, int partitionStateVersion, boolean isTransient) { long leaseTime = Math.min(tx.getTimeoutMillis(), LOCK_LEASE_EXTENSION_MILLIS); for (Member member : members) { tx.add(new ClusterStateTransactionLogRecord(stateChange, node.getThisAddress(), member.getAddress(), tx.getTxnId(), leaseTime, memberListVersion, partitionStateVersion, isTransient)); } }
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 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); }
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); }
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); }
Data peekInternal(long timeout) { QueueItem offer = offeredQueue.peek(); long itemId = offer == null ? -1 : offer.getItemId(); TxnPeekOperation operation = new TxnPeekOperation(name, timeout, itemId, tx.getTxnId()); try { Future<QueueItem> future = invoke(operation); QueueItem item = future.get(); if (item != null) { if (offer != null && item.getItemId() == offer.getItemId()) { return offer.getData(); } return item.getData(); } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return null; }
Data peekInternal(long timeout) { QueueItem offer = offeredQueue.peek(); long itemId = offer == null ? -1 : offer.getItemId(); TxnPeekOperation operation = new TxnPeekOperation(name, timeout, itemId, tx.getTxnId()); try { Future<QueueItem> future = invoke(operation); QueueItem item = future.get(); if (item != null) { if (offer != null && item.getItemId() == offer.getItemId()) { return offer.getData(); } return item.getData(); } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return null; }
public boolean add(E e) { checkTransactionActive(); checkObjectNotNull(e); Data value = getNodeEngine().toData(e); CollectionReserveAddOperation operation = new CollectionReserveAddOperation(name, tx.getTxnId(), null); try { Future<Long> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId); Long itemId = future.get(); if (itemId != null) { if (!itemIdSet.add(itemId)) { throw new TransactionException("Duplicate itemId: " + itemId); } getCollection().add(new CollectionItem(itemId, value)); CollectionTxnAddOperation op = new CollectionTxnAddOperation(name, itemId, value); putToRecord(op); return true; } } catch (Throwable t) { throw rethrow(t); } return false; }
= new TxnReserveOfferOperation(name, timeout, offeredQueue.size(), tx.getTxnId()); operation.setCallerUuid(tx.getOwnerUuid()); try {
= new TxnReserveOfferOperation(name, timeout, offeredQueue.size(), tx.getTxnId()); operation.setCallerUuid(tx.getOwnerUuid()); try {
name, reservedItemId, value, tx.getTxnId()); try { Future<CollectionItem> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId);
name, reservedItemId, value, tx.getTxnId()); try { Future<CollectionItem> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId);
public boolean add(E e) { checkTransactionActive(); checkObjectNotNull(e); Data value = getNodeEngine().toData(e); CollectionReserveAddOperation operation = new CollectionReserveAddOperation(name, tx.getTxnId(), null); try { Future<Long> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId); Long itemId = future.get(); if (itemId != null) { if (!itemIdSet.add(itemId)) { throw new TransactionException("Duplicate itemId: " + itemId); } getCollection().add(new CollectionItem(itemId, value)); CollectionTxnAddOperation op = new CollectionTxnAddOperation(name, itemId, value); putToRecord(op); return true; } } catch (Throwable t) { throw rethrow(t); } return false; }
@Override public boolean add(E e) { checkTransactionActive(); checkObjectNotNull(e); Data value = getNodeEngine().toData(e); if (!getCollection().add(new CollectionItem(INVALID_ITEM_ID, value))) { return false; } CollectionReserveAddOperation operation = new CollectionReserveAddOperation(name, tx.getTxnId(), value); try { Future<Long> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId); Long itemId = future.get(); if (itemId != null) { if (!itemIdSet.add(itemId)) { throw new TransactionException("Duplicate itemId: " + itemId); } CollectionTxnAddOperation op = new CollectionTxnAddOperation(name, itemId, value); putToRecord(op); return true; } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return false; }
@Override public boolean add(E e) { checkTransactionActive(); checkObjectNotNull(e); Data value = getNodeEngine().toData(e); if (!getCollection().add(new CollectionItem(INVALID_ITEM_ID, value))) { return false; } CollectionReserveAddOperation operation = new CollectionReserveAddOperation(name, tx.getTxnId(), value); try { Future<Long> future = operationService.invokeOnPartition(getServiceName(), operation, partitionId); Long itemId = future.get(); if (itemId != null) { if (!itemIdSet.add(itemId)) { throw new TransactionException("Duplicate itemId: " + itemId); } CollectionTxnAddOperation op = new CollectionTxnAddOperation(name, itemId, value); putToRecord(op); return true; } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return false; }
Data pollInternal(long timeout) { QueueItem reservedOffer = offeredQueue.peek(); long itemId = reservedOffer == null ? -1 : reservedOffer.getItemId(); TxnReservePollOperation operation = new TxnReservePollOperation(name, timeout, itemId, tx.getTxnId()); operation.setCallerUuid(tx.getOwnerUuid()); try { Future<QueueItem> future = invoke(operation); QueueItem item = future.get(); if (item != null) { if (reservedOffer != null && item.getItemId() == reservedOffer.getItemId()) { offeredQueue.poll(); removeFromRecord(reservedOffer.getItemId()); itemIdSet.remove(reservedOffer.getItemId()); return reservedOffer.getData(); } // if (!itemIdSet.add(item.getItemId())) { throw new TransactionException("Duplicate itemId: " + item.getItemId()); } TxnPollOperation txnPollOperation = new TxnPollOperation(name, item.getItemId()); putToRecord(txnPollOperation); return item.getData(); } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return null; }
Data pollInternal(long timeout) { QueueItem reservedOffer = offeredQueue.peek(); long itemId = reservedOffer == null ? -1 : reservedOffer.getItemId(); TxnReservePollOperation operation = new TxnReservePollOperation(name, timeout, itemId, tx.getTxnId()); operation.setCallerUuid(tx.getOwnerUuid()); try { Future<QueueItem> future = invoke(operation); QueueItem item = future.get(); if (item != null) { if (reservedOffer != null && item.getItemId() == reservedOffer.getItemId()) { offeredQueue.poll(); removeFromRecord(reservedOffer.getItemId()); itemIdSet.remove(reservedOffer.getItemId()); return reservedOffer.getData(); } // if (!itemIdSet.add(item.getItemId())) { throw new TransactionException("Duplicate itemId: " + item.getItemId()); } TxnPollOperation txnPollOperation = new TxnPollOperation(name, item.getItemId()); putToRecord(txnPollOperation); return item.getData(); } } catch (Throwable t) { throw ExceptionUtil.rethrow(t); } return null; }
tx.begin(); try { String txnId = tx.getTxnId(); Collection<MemberImpl> members = memberMap.getMembers(); int memberListVersion = memberMap.getVersion();
tx.begin(); try { String txnId = tx.getTxnId(); Collection<MemberImpl> members = memberMap.getMembers(); int memberListVersion = memberMap.getVersion();