for (int i = 0; i < 3; i++) { assertTrue(iter.hasNext()); assertTrue(keys.remove(((Region.Entry)iter.next()).getKey())); for (int i = 0; i < 3; i++) { assertTrue(iter.hasNext()); assertTrue(keys.remove(((Region.Entry) iter.next()).getKey())); region.destroy(entry.getKey()); if (entry.isLocal()) { assertTrue(entry.isDestroyed()); } else { assertFalse(entry.isDestroyed());
if (rcvr instanceof Region.Entry) { Region.Entry re = (Region.Entry) rcvr; if (re.isDestroyed()) { return QueryService.UNDEFINED; rcvr = re.getValue(); } else if (rcvr instanceof CqEntry) { CqEntry re = (CqEntry) rcvr; Region.Entry entry = ((QRegion) rcvr).getEntry(index); if (entry == null) { return null; } return this.evalRegionAsEntry ? entry : entry.getValue();
public RemoteEntrySnapshot(Region.Entry entry, boolean statsEnabled) throws CacheException { Object entryName = entry.getKey(); if (entryName instanceof String || entryName instanceof Number) { name = entryName; } else { name = new RemoteObjectName(entryName); } Object val = entry.getValue(); if (val != null) { this.value = val.getClass().getName() + "\"" + val.toString() + "\""; } else { this.value = null; } Object attr = entry.getUserAttribute(); if (attr != null) { this.userAttribute = attr.getClass().getName() + "\"" + attr.toString() + "\""; } else { this.userAttribute = null; } if (statsEnabled) { this.stats = new RemoteCacheStatistics(entry.getStatistics()); } else { this.stats = new RemoteCacheStatistics(); } } /**
region.localDestroyRegion(); assertTrue(entry.isDestroyed()); assertTrue(region.isDestroyed());
if (values[0] instanceof Region.Entry) { Region.Entry e = (Region.Entry) values[0]; if (!e.isDestroyed()) { try { values[0] = new CqEntry(e.getKey(), e.getValue()); } catch (EntryDestroyedException ede) {
region.destroyRegion(); assertTrue(entry.isDestroyed()); assertTrue(region.isDestroyed());
if (values[0] instanceof Region.Entry) { Region.Entry e = (Region.Entry) values[0]; if (!e.isDestroyed()) { try { values[0] = new CqEntry(e.getKey(), e.getValue()); } catch (EntryDestroyedException ede) {
cmtre.setUserAttribute("uaValue1"); assertEquals("uaValue1", cmtre.getUserAttribute()); this.txMgr.begin(); Region.Entry re = this.region.getEntry("uaKey"); assertEquals(this.region, re.getRegion()); assertEquals(this.region, txre.getRegion()); try { txre.setUserAttribute("uaValue2"); fail("expected UnsupportedOperationException"); } catch (UnsupportedOperationException e) { txre.getUserAttribute(); fail("expected UnsupportedOperationException"); } catch (UnsupportedOperationException e) { re.setUserAttribute("uaValue2"); fail("expected UnsupportedOperationException"); } catch (UnsupportedOperationException e) { re.getUserAttribute(); txre.getValue(); fail("expected IllegalTransactionStateException"); } catch (IllegalTransactionStateException ok) { txre.isDestroyed(); fail("expected IllegalTransactionStateException");
if (re.isDestroyed()) { return QueryService.UNDEFINED; evalRcvr = re.getValue(); } catch (EntryDestroyedException ede){
if (re.isDestroyed()) { return QueryService.UNDEFINED; evalRcvr = re.getValue(); } catch (EntryDestroyedException ede){
assertTrue(entry.isDestroyed()); assertEquals(0, region.keys().size()); entry.getKey(); fail("Should have thrown an EntryDestroyedException"); entry.getRegion(); fail("Should have thrown an EntryDestroyedException"); entry.getStatistics(); fail("Should have thrown an EntryDestroyedException"); entry.getUserAttribute(); fail("Should have thrown an EntryDestroyedException"); entry.setUserAttribute("blah"); fail("Should have thrown an EntryDestroyedException"); entry.getValue(); fail("Should have thrown an EntryDestroyedException");
getLogWriter().info("Found entry for destroyed key: " + entry2); assertNull(entry2); if (entry.isLocal()) { assertTrue(entry.isDestroyed()); } else { assertFalse(entry.isDestroyed()); if (entry.isLocal()) { try { entry.getKey(); fail("Should have thrown an EntryDestroyedException"); entry.getRegion(); fail("Should have thrown an EntryDestroyedException"); entry.getStatistics(); fail("Should have thrown an EntryDestroyedException"); entry.getUserAttribute(); fail("Should have thrown an EntryDestroyedException"); entry.setUserAttribute("blah"); fail("Should have thrown an EntryDestroyedException"); entry.getValue(); fail("Should have thrown an EntryDestroyedException");
iter.hasNext()); assertTrue("remove returned false, i=" + i, keys.remove(((Region.Entry) iter.next()).getKey())); iter.hasNext()); assertTrue("remove returned false, i=" + i, keys.remove(((Region.Entry) iter.next()).getKey())); Object ekey = entry.getKey(); region.destroy(ekey); assertEquals(false, region.containsKey(ekey)); assertTrue(entry.isDestroyed());
assertEquals(null, cmtre.getUserAttribute()); txMgrImpl.begin(); Region.Entry txre = this.region.getEntry("key1"); txre.setUserAttribute("uaValue1"); txMgrImpl.commit(); assertEquals("uaValue1", cmtre.getUserAttribute()); this.region.localDestroy("key1"); assertEquals("value0", cmtre.getValue()); assertEquals(null, cmtre.getUserAttribute()); this.txMgr.begin(); txre = this.region.getEntry("key1"); assertEquals("value0", txre.getValue()); this.region.put("key1", "valueTX"); assertEquals("valueTX", txre.getValue()); assertEquals("value0", cmtre.getValue()); assertEquals(null, txre.getUserAttribute()); txre.setUserAttribute("uaValue1"); assertEquals("uaValue1", txre.getUserAttribute()); assertEquals(null, cmtre.getUserAttribute()); cmtre.setUserAttribute("uaValue2"); assertEquals("uaValue2", cmtre.getUserAttribute()); assertEquals("uaValue1", txre.getUserAttribute()); try { txMgrImpl.commit(); txre.getValue(); fail("expected IllegalTransactionStateException"); } catch (IllegalTransactionStateException ok) {
if (evalRcvr instanceof Region.Entry) { Region.Entry re = (Region.Entry) evalRcvr; if (re.isDestroyed()) { return QueryService.UNDEFINED; evalRcvr = re.getValue(); } else if (evalRcvr instanceof CqEntry) { CqEntry re = (CqEntry) evalRcvr;
if (evalRcvr instanceof Region.Entry) { Region.Entry re = (Region.Entry) evalRcvr; if (re.isDestroyed()) { return QueryService.UNDEFINED; evalRcvr = re.getValue(); } else if (evalRcvr instanceof CqEntry) { CqEntry re = (CqEntry) evalRcvr;
/** * Tests that an attempt to get statistics when they are disabled * results in a {@link StatisticsDisabledException}. */ public void testDisabledStatistics() throws CacheException { String name = this.getUniqueName(); Object key = "KEY"; Object value = "VALUE"; AttributesFactory factory = new AttributesFactory(); factory.setStatisticsEnabled(false); Region region = createRegion(name, factory.create()); try { region.getStatistics(); fail("Should have thrown a StatisticsDisabledException"); } catch (StatisticsDisabledException ex) { // pass... } region.put(key, value); Region.Entry entry = region.getEntry(key); try { entry.getStatistics(); } catch (StatisticsDisabledException ex) { // pass... } }
if (entry.isDestroyed()) { aStr.append("Entry has been destroyed\n"); } else {
public RemoteEntrySnapshot(Region.Entry entry, boolean statsEnabled) throws CacheException { Object entryName = entry.getKey(); if (entryName instanceof String || entryName instanceof Number) { name = entryName; } else { name = new RemoteObjectName(entryName); } Object val = entry.getValue(); if (val != null) { this.value = val.getClass().getName() + "\"" + val.toString() + "\""; } else { this.value = null; } Object attr = entry.getUserAttribute(); if (attr != null) { this.userAttribute = attr.getClass().getName() + "\"" + attr.toString() + "\""; } else { this.userAttribute = null; } if (statsEnabled) { this.stats = new RemoteCacheStatistics(entry.getStatistics()); } else { this.stats = new RemoteCacheStatistics(); } } /**