/** * All entries for the LRUCapacityController are * considered to be of size 1. */ public int entrySize( Object key, Object value ) throws IllegalArgumentException { if (Token.isRemoved(value) /*&& (value != Token.TOMBSTONE)*/) { // un-comment to make tombstones visible // bug #42228 - lruEntryDestroy removes an entry from the LRU, but if // it is subsequently resurrected we want the new entry to generate a delta return 0; } if ((value == null /* overflow to disk */ || value == Token.INVALID || value == Token.LOCAL_INVALID) && getEvictionAction().isOverflowToDisk()) { // Don't count this guys toward LRU return 0; } else { return 1; } }
/** * All entries for the LRUCapacityController are * considered to be of size 1. */ public int entrySize( Object key, Object value ) throws IllegalArgumentException { if (Token.isRemoved(value) /*&& (value != Token.TOMBSTONE)*/) { // un-comment to make tombstones visible // bug #42228 - lruEntryDestroy removes an entry from the LRU, but if // it is subsequently resurrected we want the new entry to generate a delta return 0; } if ((value == null /* overflow to disk */ || value == Token.INVALID || value == Token.LOCAL_INVALID) && getEvictionAction().isOverflowToDisk()) { // Don't count this guys toward LRU return 0; } else { return 1; } }
public boolean isOverflowEnabled() { EvictionAttributes ea = getAttributes().getEvictionAttributes(); return ea != null && ea.getAction().isOverflowToDisk(); }
protected boolean isOverflowEnabled() { EvictionAttributes ea = getAttributes().getEvictionAttributes(); return ea != null && ea.getAction().isOverflowToDisk(); }
protected boolean requiresPersistence(RegionDescription rd) { return rd.getDataPolicy().withPersistence() || (rd.getEvictionAttributes() != null && rd.getEvictionAttributes().getAction().isOverflowToDisk()); }
protected boolean requiresPersistence(RegionDescription rd) { return rd.getDataPolicy().withPersistence() || (rd.getEvictionAttributes() != null && rd.getEvictionAttributes().getAction().isOverflowToDisk()); }
/** Set a random DiskStore for the region defined with regionConfigName if * it is persistent or has eviction with overflow to disk. * @param regionConfigName A hydra region config name. * return factory The attributes factory for the regionConfigName with possibly * a DiskStore. */ public static AttributesFactory setDiskStoreIfNeeded(String regionConfigName) { AttributesFactory factory = RegionHelper.getAttributesFactory(regionConfigName); RegionDescription desc = RegionHelper.getRegionDescription(regionConfigName); EvictionAttributes evAttr = desc.getEvictionAttributes(); if ((desc.getDataPolicy().withPersistence()) || ((evAttr != null) && (evAttr.getAction().isOverflowToDisk()))) { List diskStoreNames = TestConfig.tab().vecAt(DiskStorePrms.names); factory.setDiskStoreName((String)(diskStoreNames.get(TestConfig.tab().getRandGen().nextInt(1, diskStoreNames.size()-1)))); } return factory; }
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } });
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); factory.addCacheListener(new MirroredDataFromNonMirroredListener()); createRegion(name, factory.create()); } });
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); factory.setCacheLoader(new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { return value; } }); createRegion(name, factory.create()); } });
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); factory.setCacheLoader(new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { return value; } }); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); loader = new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { fail("Should not be invoked"); return null; } }; factory.setCacheLoader(loader); createRegion(name, factory.create()); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); Region region = createRegion(name, factory.create()); region.put(key1, value1); region.put(key2, value2); region.put(key3, value3); } };
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory fac = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { fac.setDiskStoreName(null); } fac.setDataPolicy(DataPolicy.NORMAL); //fac.setPersistBackup(false); Region region = createRegion(name, fac.create()); region.put(key1, value1); region.put(key2, value2); region.put(key3, value3); } };
public IndexManager(Region region) { this.region = region; // must be a SortedMap to ensure the indexes are iterated over in fixed // order // to avoid deadlocks when acquiring locks //indexes = Collections.synchronizedSortedMap(new TreeMap()); indexMaintenanceSynchronous = region.getAttributes() .getIndexMaintenanceSynchronous(); isOverFlowToDisk = region.getAttributes().getEvictionAttributes() .getAction().isOverflowToDisk(); this.offHeap = region.getAttributes().getOffHeap(); if (!indexMaintenanceSynchronous) { final LoggingThreadGroup group = LoggingThreadGroup.createThreadGroup("QueryMonitor Thread Group", logger); updater = new IndexUpdaterThread(group, this.INDEX_MAINTENANCE_BUFFER, "OqlIndexUpdater:" + region.getFullPath()); updater.start(); } }
public IndexManager(Region region) { this.region = region; this.logger = region.getCache().getLoggerI18n(); // must be a SortedMap to ensure the indexes are iterated over in fixed // order // to avoid deadlocks when acquiring locks //indexes = Collections.synchronizedSortedMap(new TreeMap()); indexMaintenanceSynchronous = region.getAttributes() .getIndexMaintenanceSynchronous(); isOverFlowToDisk = region.getAttributes().getEvictionAttributes() .getAction().isOverflowToDisk(); if (!indexMaintenanceSynchronous) { final LogWriterImpl.LoggingThreadGroup group = LogWriterImpl.createThreadGroup("QueryMonitor Thread Group", region.getCache().getLoggerI18n()); updater = new IndexUpdaterThread(group, this.INDEX_MAINTENANCE_BUFFER, "OqlIndexUpdater:" + region.getFullPath()); updater.start(); } }