public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); Region<Object, Object> custRegion = getCache().getRegion(CUSTOMER); assertEquals(expectedCustomerUpdate, custRegion.get(expectedCustId)); // check in the other active transaction // force other active transaction TXStateInterface tx = mgr.getHostedTXState(txId1); TXStateInterface txOrig = mgr.getTXState(); mgr.setTXState(tx); assertEquals(expectedCustomer, custRegion.get(expectedCustId)); mgr.setTXState(txOrig); return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertFalse(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); // no TXRegionStates for reads on store at READ_COMMITTED assertNull(tx); return null; } });
@Override public Object call() throws Exception { Region rgn = getCache().getRegion(name); assertNull(rgn.get("txkey")); TXManagerImpl txMgr = getGemfireCache().getTxManager(); TXStateProxy tx = txMgr.getHostedTXState(txid); assertEquals(1, tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertEquals("txkey", key); assertNotNull(es.getValue(r)); if (key.equals("txkey")) assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); // 2 buckets for the two puts we did in the accessor one dist. region, // and one more bucket if Cust1 and Cust10 resolve to different buckets assertEquals("unexpected regions: " + tx.getRegions(), 2, tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue("key:"+key+" r:"+r.getFullPath(), es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 1 : 2; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 1 bucket for the put we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNull(es.getValue(r)); assertTrue("key:" + key + " r:" + r.getFullPath(), es.isDirty()); } } return null; } });
public Object call() throws Exception { TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); final int n = tx.getProxy().batchingEnabled() ? 2 : 3; assertEquals("unexpected regions: " + tx.getRegions(), n, tx.getRegions().size());// 2 buckets for the two puts we // did in the accessor for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); Log.getLogWriter().warning( "SUP IS IT NULL(" + key + "):" + es.getValue(r)); assertNotNull(es.getValue(r)); assertTrue(es.isDirty()); } } return null; } });
public Object call() throws Exception { Region cust = getCache().getRegion(CUSTOMER); int hash1 = PartitionedRegionHelper.getHashKey((PartitionedRegion)cust, new CustId(1)); int hash10 = PartitionedRegionHelper.getHashKey((PartitionedRegion)cust, new CustId(10)); TXManagerImpl mgr = getGemfireCache().getTxManager(); assertTrue(mgr.isHostedTxInProgress(txId)); TXStateInterface tx = mgr.getHostedTXState(txId); // 2 buckets for the two puts we did in the accessor one dist. region, // and one more bucket if Cust1 and Cust10 resolve to different buckets assertEquals("unexpected regions: " + tx.getRegions(), 3 + (hash1 == hash10 ? 0 : 1), tx.getRegions().size()); for (LocalRegion r : tx.getRegions()) { assertTrue(r instanceof BucketRegion || r instanceof DistributedRegion); TXRegionState rs = tx.readRegion(r); for (Object key : rs.getEntryKeys()) { TXEntryState es = (TXEntryState)rs.readEntry(key); assertNotNull(es.getValue(r)); assertTrue("key:"+key+" r:"+r.getFullPath(), es.isDirty()); } } return null; } });
GemFireTransaction tc = (GemFireTransaction)lcc.getTransactionExecute(); TXManagerImpl txManager = tc.getTransactionManager(); TXStateProxy state = txManager.getHostedTXState(txId1); TXManagerImpl.TXContext context = TXManagerImpl.getOrCreateTXContext();
public Object call() throws Exception { Region<Object, Object> custRegion = getCache().getRegion(CUSTOMER); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXStateInterface tx = mgr.getHostedTXState(txId2); // force expected transaction TXStateInterface txOrig = mgr.getTXState(); mgr.setTXState(tx); tx = mgr.internalSuspend(); assertNull(custRegion.get(expectedCustId)); mgr.resume(tx); assertEquals(expectedCustomer, custRegion.get(expectedCustId)); mgr.setTXState(txOrig); return null; } });
TXId txId1 = TXId.valueOf(memberId, uniqId); txState = txManager.getHostedTXState(txId1);
TXId txId1 = TXId.valueOf(memberId, uniqId); txState = txManager.getHostedTXState(txId1);
public Object call() throws Exception { Region<Object, Object> custRegion = getCache().getRegion(CUSTOMER); Region<Object, Object> orderRegion = getCache().getRegion(ORDER); Region<Object, Object> refRegion = getCache().getRegion(D_REFERENCE); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXStateInterface tx = mgr.getHostedTXState(txId); // force expected transaction TXStateInterface txOrig = mgr.getTXState(); mgr.setTXState(tx); assertEquals(expectedCustomer, custRegion.get(expectedCustId)); assertEquals(expectedOrder, orderRegion.get(expectedOrderId)); assertEquals(expectedCustomer, refRegion.get(expectedCustId)); mgr.internalSuspend(); assertNull(custRegion.get(expectedCustId)); assertNull(orderRegion.get(expectedOrderId)); assertNull(refRegion.get(expectedCustId)); mgr.setTXState(txOrig); return null; } });
public Object call() throws Exception { LocalRegion custRegion = (LocalRegion)getCache().getRegion(CUSTOMER); LocalRegion orderRegion = (LocalRegion)getCache().getRegion(ORDER); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXState txState = mgr.getHostedTXState(txId2).getLocalTXState(); final TXStateInterface currentTX = mgr.getTXState(); mgr.masqueradeAs(txState); for (int index = 0; index < 10; ++index) { final CustId custId = new CustId(index); assertEquals(new Customer("customer" + index, "address" + index), txState.getEntry(new KeyInfo(custId, null, null), custRegion, false, false).getValue()); assertEquals(new Order("order" + index), txState.getEntry( new KeyInfo(new OrderId(index, custId), null, null), orderRegion, false, false).getValue()); } mgr.masqueradeAs(currentTX); return null; } });
final TXStateProxy txProxy; if (!cache.getMyId().equals(sender) && (txProxy = cache.getCacheTransactionManager().getHostedTXState( this.txId)) != null) { if (this.isDirty) {
public Object call() throws Exception { LocalRegion custRegion = (LocalRegion)getCache().getRegion(CUSTOMER); LocalRegion orderRegion = (LocalRegion)getCache().getRegion(ORDER); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXState txState = mgr.getHostedTXState(txId).getLocalTXState(); final TXStateInterface currentTX = mgr.getTXState(); mgr.masqueradeAs(txState); for (int index = 0; index < 10; ++index) { final CustId custId = new CustId(index); assertEquals(new Customer("customer" + index, "address" + index), txState.getEntry(new KeyInfo(custId, null, null), custRegion, false, false).getValue()); assertEquals(new Order("order" + index), txState.getEntry( new KeyInfo(new OrderId(index, custId), null, null), orderRegion, false, false).getValue()); } mgr.masqueradeAs(currentTX); return null; } });
public Object call() throws Exception { LocalRegion custRegion = (LocalRegion)getCache().getRegion(CUSTOMER); LocalRegion orderRegion = (LocalRegion)getCache().getRegion(ORDER); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXState txState = mgr.getHostedTXState(txId).getLocalTXState(); final TXStateInterface currentTX = mgr.getTXState(); mgr.masqueradeAs(txState); for (int index = 0; index < 10; ++index) { final CustId custId = new CustId(index); assertEquals(new Customer("customer" + index, "address" + index), txState.getEntry(new KeyInfo(custId, null, null), custRegion, false, false).getValue()); assertEquals(new Order("order" + index), txState.getEntry( new KeyInfo(new OrderId(index, custId), null, null), orderRegion, false, false).getValue()); } mgr.masqueradeAs(currentTX); return null; } });
public Object call() throws Exception { LocalRegion custRegion = (LocalRegion)getCache().getRegion(CUSTOMER); LocalRegion orderRegion = (LocalRegion)getCache().getRegion(ORDER); TXManagerImpl mgr = getGemfireCache().getTxManager(); TXState txState = mgr.getHostedTXState(txId2).getLocalTXState(); final TXStateInterface currentTX = mgr.getTXState(); mgr.masqueradeAs(txState); for (int index = 0; index < 10; ++index) { final CustId custId = new CustId(index); assertEquals(new Customer("customer" + index, "address" + index), txState.getEntry(new KeyInfo(custId, null, null), custRegion, false, false).getValue()); assertEquals(new Order("order" + index), txState.getEntry( new KeyInfo(new OrderId(index, custId), null, null), orderRegion, false, false).getValue()); } mgr.masqueradeAs(currentTX); return null; } });
if ((cache = GemFireCacheImpl.getInstance()) != null && (txMgr = cache.getCacheTransactionManager()) != null && (proxy = txMgr.getHostedTXState(this.pendingTXId)) != null) { proxy.waitForLocalTXCommit(this.txId, 0);