/** * Gets the prettified contents of the specified region as a string. * * @param region the region whose contents to print. * @param recursive whether or not to print subregions recursively. */ public static String getContentString( Region region, boolean recursive ) { if ( region == null ) throw new IllegalArgumentException( "Region is null" ); StringBuffer buf = new StringBuffer(); Set set = region.entries( recursive ); for ( Iterator i = set.iterator(); i.hasNext(); ) { Region.Entry entry = (Region.Entry) i.next(); buf.append( "[" ); buf.append( entry.getRegion().getFullPath() ); buf.append( "]" ); buf.append( entry.getKey() ).append( "=" ); buf.append( entry.getValue() ).append( "\n" ); } return buf.toString(); }
entry.getRegion(); fail("Should have thrown an EntryDestroyedException");
entry.getRegion(); fail("Should have thrown an EntryDestroyedException");
private boolean isEntryDestroyed(Region.Entry re) { if (re.isLocal()) { return re.isDestroyed(); } else { Region r = re.getRegion(); Object key = re.getKey(); Region.Entry freshRE = r.getEntry(key); if (freshRE == null) { return true; } return freshRE.isDestroyed(); } }
private Object fetchEntryValue(Region.Entry re) { if (re.isLocal()) { return re.getValue(); } else { Region r = re.getRegion(); Object key = re.getKey(); Region.Entry freshRE = r.getEntry(key); if (freshRE == null) { return null; // or should we throw an exception? } return freshRE.getValue(); } } /**
public Entry getEntryOnRemote(KeyInfo key, LocalRegion localRegion, boolean allowTombstones) throws DataLocationException { PartitionedRegion pr = (PartitionedRegion)localRegion; Region.Entry txval = getEntry(key, pr, allowTombstones); if(txval==null) { throw new EntryNotFoundException(LocalizedStrings.PartitionedRegionDataStore_ENTRY_NOT_FOUND.toLocalizedString()); } else { NonLocalRegionEntry nlre = new NonLocalRegionEntry(txval, localRegion); LocalRegion dataReg = localRegion.getDataRegionForRead(key); return new EntrySnapshot(nlre,dataReg,(LocalRegion)txval.getRegion(), allowTombstones); } }