@Override public Object findObject(KeyInfo key, LocalRegion r, boolean isCreate, boolean generateCallbacks, Object value, boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones) { TXStateProxy tx = r.cache.getTXMgr().pauseTransaction(); try { return r.findObjectInSystem(key, isCreate, tx, generateCallbacks, value, disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones); } finally { r.cache.getTXMgr().unpauseTransaction(tx); } }
@Override public Entry getEntry(KeyInfo keyInfo, LocalRegion localRegion, boolean allowTombstones) { TXStateProxy tx = localRegion.cache.getTXMgr().pauseTransaction(); try { PartitionedRegion pr = (PartitionedRegion) localRegion; return pr.nonTXGetEntry(keyInfo, false, allowTombstones); } finally { localRegion.cache.getTXMgr().unpauseTransaction(tx); } }
@Test public void sendsWithTransactionPaused_ifTransactionIsHostedLocally() throws Exception { // Transaction is locally hosted when(txStateProxy.isRealDealLocal()).thenReturn(true); when(txStateProxy.isDistTx()).thenReturn(false); FetchKeysMessage.send(recipient, region, 1, false); InOrder inOrder = inOrder(txManager, distributionManager); inOrder.verify(txManager, times(1)).pauseTransaction(); inOrder.verify(distributionManager, times(1)).putOutgoing(sentMessage.capture()); inOrder.verify(txManager, times(1)).unpauseTransaction(same(txStateProxy)); assertThat(sentMessage.getValue().getTXUniqId()).isEqualTo(TXManagerImpl.NOTX); }
@Test public void sendsWithoutPausingTransaction_ifTransactionIsNotHostedLocally() throws Exception { // Transaction is not locally hosted when(txStateProxy.isRealDealLocal()).thenReturn(false); int uniqueId = 99; TXId txID = new TXId(recipient, uniqueId); when(txStateProxy.getTxId()).thenReturn(txID); FetchKeysMessage.send(recipient, region, 1, false); verify(distributionManager, times(1)).putOutgoing(sentMessage.capture()); assertThat(sentMessage.getValue().getTXUniqId()).isEqualTo(uniqueId); verify(txManager, never()).pauseTransaction(); verify(txManager, never()).unpauseTransaction(any()); } }
@Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "UL_UNRELEASED_LOCK", justification = "This method unlocks and then conditionally undoes the unlock in the finally-block. Review again at later time.") public int entryCount(LocalRegion localRegion) { // if size is the first operation in the transaction, then reset the txState boolean resetTXState = this.realDeal == null; TXStateProxy txp = null; boolean txUnlocked = false; if (resetTXState) { txp = getTxMgr().pauseTransaction(); } else { if (getLock().isHeldByCurrentThread()) { txUnlocked = true; // bug #42945 - hang trying to compute size for PR getLock().unlock(); } } try { if (resetTXState) { return localRegion.getSharedDataView().entryCount(localRegion); } return getRealDeal(null, localRegion).entryCount(localRegion); } finally { if (resetTXState) { getTxMgr().unpauseTransaction(txp); } else if (txUnlocked) { getLock().lock(); } } }
cache.getTXMgr().unpauseTransaction(tx);
assertThat(rgn.containsKey("key")).isTrue(); assertThat(rgn.getEntry("key").getValue()).isEqualTo("LV 1"); ((TXManagerImpl) txMgr).unpauseTransaction(tx); ((TXManagerImpl) txMgr).unpauseTransaction(tx); ((TXManagerImpl) txMgr).unpauseTransaction(tx);
((TXManagerImpl) this.cache.getCacheTransactionManager()).unpauseTransaction(tx);
this.cache.getTXMgr().unpauseTransaction(txState);
} finally { if (resetTxState) { txManager.unpauseTransaction(txStateProxy);
@Override public Set getBucketKeys(LocalRegion localRegion, int bucketId, boolean allowTombstones) { boolean resetTxState = isTransactionInternalSuspendNeeded(localRegion); TXStateProxy txp = null; if (resetTxState) { txp = getTxMgr().pauseTransaction(); } try { if (resetTxState) { return localRegion.getSharedDataView().getBucketKeys(localRegion, bucketId, false); } return getRealDeal(null, localRegion).getBucketKeys(localRegion, bucketId, false); } finally { if (resetTxState) { getTxMgr().unpauseTransaction(txp); } } }
((TXManagerImpl) this.cache.getCacheTransactionManager()).unpauseTransaction(tx);
@Override public Object getEntryForIterator(KeyInfo key, LocalRegion currRgn, boolean rememberReads, boolean allowTombstones) { boolean resetTxState = isTransactionInternalSuspendNeeded(currRgn); TXStateProxy txp = null; if (resetTxState) { txp = getTxMgr().pauseTransaction(); } try { if (resetTxState) { return currRgn.getSharedDataView().getEntry(key, currRgn, allowTombstones); } return getRealDeal(key, currRgn).getEntryForIterator(key, currRgn, rememberReads, allowTombstones); } finally { if (resetTxState) { getTxMgr().unpauseTransaction(txp); } } }
@Override public Object getKeyForIterator(KeyInfo keyInfo, LocalRegion currRgn, boolean rememberReads, boolean allowTombstones) { boolean resetTxState = isTransactionInternalSuspendNeeded(currRgn); TXStateProxy txp = null; if (resetTxState) { txp = getTxMgr().pauseTransaction(); } try { if (resetTxState) { return currRgn.getSharedDataView().getKeyForIterator(keyInfo, currRgn, rememberReads, allowTombstones); } return getRealDeal(keyInfo, currRgn).getKeyForIterator(keyInfo, currRgn, rememberReads, allowTombstones); } finally { if (resetTxState) { getTxMgr().unpauseTransaction(txp); } } }
pdxClassToMethodsMap.remove(); queryCanceled.remove(); ((TXManagerImpl) this.cache.getCacheTransactionManager()).unpauseTransaction(tx);
this.cache.getTXMgr().unpauseTransaction(tx);
@Override public Collection<?> getRegionKeysForIteration(LocalRegion currRegion) { if (currRegion.isUsedForPartitionedRegionBucket()) { return currRegion.getRegionKeysForIteration(); } else { boolean resetTxState = isTransactionInternalSuspendNeeded(currRegion); TXStateProxy txp = null; if (resetTxState) { txp = getTxMgr().pauseTransaction(); } try { if (resetTxState) { return currRegion.getSharedDataView().getRegionKeysForIteration(currRegion); } return getRealDeal(null, currRegion).getRegionKeysForIteration(currRegion); } finally { if (resetTxState) { getTxMgr().unpauseTransaction(txp); } } } }
this.transactionManager.unpauseTransaction(tx);
this.cache.getTXMgr().unpauseTransaction(tx);
@Override public Object getEntryForIterator(KeyInfo curr, LocalRegion currRgn, boolean rememberReads, boolean allowTombstones) { if (currRgn instanceof PartitionedRegion) { PartitionedRegion pr = (PartitionedRegion) currRgn; if (!pr.getBucketPrimary(curr.getBucketId()).equals(pr.cache.getMyId())) { // to fix bug 47893 suspend the tx before calling nonTXGetEntry final TXManagerImpl txmgr = pr.getGemFireCache().getTXMgr(); final TXStateProxy tx = txmgr.pauseTransaction(); try { return pr.nonTXGetEntry(curr, false, allowTombstones); } finally { txmgr.unpauseTransaction(tx); } } } TXEntryState txEntryState = readEntryAndCheckIfDestroyed(curr, currRgn, rememberReads, allowTombstones); if (txEntryState != null) { // need to create KeyInfo since higher level iterator may reuse KeyInfo return new TXEntry(currRgn, new KeyInfo(curr.getKey(), curr.getCallbackArg(), curr.getBucketId()), proxy, rememberReads); } return null; }