/** * Getter for manager to allow pausing and resuming transactions * @return Instance */ public CacheTransactionManager getCacheTransactionManager() { return this.cache.getCacheTransactionManager(); }
public static void commitTransactionOnServer1() { try { cache.getCacheTransactionManager().commit(); } catch (ConflictException cce) { fail("Test failed due to a ConflictException on server1 , which is not expected"); } }
public static void commitTransactionOnServer2() { try { cache.getCacheTransactionManager().commit(); fail("ConflictException is expected on server2 , as server1 has not commited the transaction yet"); } catch (ConflictException cce) { } }
public void run2() throws CacheException { getCache().getCacheTransactionManager().begin(); } });
public void run2() throws CacheException { getCache().getCacheTransactionManager().commit(); } });
public void run2() throws CacheException { getCache().getCacheTransactionManager().begin(); } });
private TXStateInterface suspendTX() { Cache c = (Cache)getIdToType().getRegionService(); TXManagerImpl txManager = (TXManagerImpl)c.getCacheTransactionManager(); TXStateInterface currentState = txManager.internalSuspend(); return currentState; }
private TXStateProxy suspendTX() { Cache c = (Cache)getIdToType().getRegionService(); TXManagerImpl txManager = (TXManagerImpl) c.getCacheTransactionManager(); TXStateProxy currentState = txManager.internalSuspend(); return currentState; }
public Object call() throws Exception { Region r = getRootRegion("r1"); getCache().getCacheTransactionManager().begin(); r.get("obj_2"); getCache().getCacheTransactionManager().commit(); return null; } });
/** Initialize this test instance * */ private void initializeInstance() { ctm = CacheHelper.getCache().getCacheTransactionManager(); sc = ResumeTxBB.getBB().getSharedCounters(); }
public void testEarlyoutOnTryResume() { CacheTransactionManager mgr = cache.getCacheTransactionManager(); mgr.begin(); TransactionId txId = mgr.suspend(); mgr.resume(txId); mgr.commit(); long start = System.currentTimeMillis(); mgr.tryResume(txId, 10, TimeUnit.SECONDS); assertTrue("did not expect tryResume to block", System.currentTimeMillis() - start < 100); }
public void run2() { Region rgn1 = getRootRegion().getSubregion(rgnName); CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager(); MyTransactionListener tl = (MyTransactionListener)txMgr2.getListeners()[0]; assertTrue(rgn1.containsKey("key")); assertTrue(rgn1.containsValueForKey("key")); assertEquals("value1", rgn1.getEntry("key").getValue()); tl.assertCounts(2, 0, 0, 0); // nothing happened remotely } });
public Object call() throws Exception { Region r = getCache().getRegion(testName); r.put("ikey", "value"); getCache().getCacheTransactionManager().begin(); r.put("key1", new byte[20]); r.invalidate("ikey"); getCache().getCacheTransactionManager().commit(); return null; } });
public Object call() throws Exception { Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); getCache().getCacheTransactionManager().begin(); CustId custId = new CustId(1); Customer customer = new Customer("customerNew", "addressNew"); custRegion.put(custId, customer); getCache().getCacheTransactionManager().commit(); return null; } });
public void run2() { Region rgn1 = getRootRegion().getSubregion(rgnName); CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager(); MyTransactionListener tl = (MyTransactionListener)txMgr2.getListeners()[0]; assertEquals("value1", rgn1.getEntry("key").getValue()); tl.assertCounts(2, 0, 0, 0); // There should be no change in counts } });
public static void doTxPuts(String regionName, int numPuts) { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); CacheTransactionManager mgr = cache.getCacheTransactionManager(); mgr.begin(); r.put(0, 0); r.put(100, 100); r.put(200, 200); mgr.commit(); }
public Object call() throws Exception { Region pr = getRootRegion("testTxEventForRegion"); CacheTransactionManager ctm = getCache().getCacheTransactionManager(); ExposedRegionTransactionListener tl = (ExposedRegionTransactionListener)ctm.getListeners()[0]; ExposedRegionCacheListener cl = (ExposedRegionCacheListener)pr.getAttributes().getCacheListeners()[0]; assertFalse(tl.exceptionOccurred); assertFalse(cl.exceptionOccurred); return null; } };
public Object call() throws Exception { Region<CustId,Customer> refRegion = getCache().getRegion(D_REFERENCE); assertNull(refRegion.get(custId)); getCache().getCacheTransactionManager().begin(); refRegion.put(custId, new Customer("name1", "address1")); return null; } });
public void run() { CacheTransactionManager txMgr2 = getCache().getCacheTransactionManager(); MyTransactionListener tl = new MyTransactionListener(); txMgr2.setListener(tl); try { createRegion(rgnName1); getSystem().getLogWriter().info("testTXMultiRegion: Created region1"); } catch (CacheException e) { fail("While creating region", e); } } };
@Override public Object call() throws Exception { Region r = getCache().getRegion(name); CacheTransactionManager tm = getCache() .getCacheTransactionManager(); getCache().getLogger().fine("SWAP:BeginTX"); tm.begin(); r.put("txkey", "txvalue"); return tm.suspend(); } });