use of org.apache.geode.internal.cache.control.MemoryEvent in project geode by apache.
the class HeapEvictor method getAllRegionList.
private List<LocalRegion> getAllRegionList() {
List<LocalRegion> allRegionList = new ArrayList<LocalRegion>();
InternalResourceManager irm = (InternalResourceManager) cache.getResourceManager();
for (ResourceListener<MemoryEvent> listener : irm.getResourceListeners(getResourceType())) {
if (listener instanceof PartitionedRegion) {
PartitionedRegion pr = (PartitionedRegion) listener;
if (includePartitionedRegion(pr)) {
allRegionList.addAll(pr.getDataStore().getAllLocalBucketRegions());
}
} else if (listener instanceof LocalRegion) {
LocalRegion lr = (LocalRegion) listener;
if (includeLocalRegion(lr)) {
allRegionList.add(lr);
}
}
}
if (HeapEvictor.MINIMUM_ENTRIES_PER_BUCKET > 0) {
Iterator<LocalRegion> iter = allRegionList.iterator();
while (iter.hasNext()) {
LocalRegion lr = iter.next();
if (lr instanceof BucketRegion) {
if (((BucketRegion) lr).getNumEntriesInVM() <= HeapEvictor.MINIMUM_ENTRIES_PER_BUCKET) {
iter.remove();
}
}
}
}
return allRegionList;
}
use of org.apache.geode.internal.cache.control.MemoryEvent in project geode by apache.
the class EvictionTestBase method sendFakeNotification.
public void sendFakeNotification() {
HeapMemoryMonitor hmm = ((InternalResourceManager) cache.getResourceManager()).getHeapMonitor();
RegionEvictorTask.TEST_EVICTION_BURST_PAUSE_TIME_MILLIS = 0;
MemoryEvent event = new MemoryEvent(getResourceType(), MemoryState.NORMAL, MemoryState.EVICTION, cache.getDistributedSystem().getDistributedMember(), 90, true, hmm.getThresholds());
getEvictor().onEvent(event);
}
Aggregations