use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class GetEntryCommand method getValueAndIsObject.
@Override
public void getValueAndIsObject(Region p_region, Object key, Object callbackArg, ServerConnection servConn, Object[] result) {
Object data = null;
LocalRegion region = (LocalRegion) p_region;
Entry entry = region.getEntry(key);
if (logger.isDebugEnabled()) {
logger.debug("GetEntryCommand: for key: {} returning entry: {}", key, entry);
}
if (entry != null) {
EntrySnapshot snap = new EntrySnapshot();
NonLocalRegionEntry re = new NonLocalRegionEntry(entry, region);
snap.setRegionEntry(re);
snap.setRegion(region);
data = snap;
}
result[0] = data;
// isObject is true
result[1] = true;
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class QueueStateImpl method handleMarker.
public void handleMarker() {
ArrayList regions = new ArrayList();
Cache cache = GemFireCacheImpl.getInstance();
if (cache == null) {
return;
}
Set rootRegions = cache.rootRegions();
for (Iterator iter1 = rootRegions.iterator(); iter1.hasNext(); ) {
Region rootRegion = (Region) iter1.next();
regions.add(rootRegion);
try {
// throws RDE
Set subRegions = rootRegion.subregions(true);
for (Iterator iter2 = subRegions.iterator(); iter2.hasNext(); ) {
regions.add(iter2.next());
}
} catch (RegionDestroyedException e) {
// region is gone go to the next one bug 38705
continue;
}
}
for (Iterator iter = regions.iterator(); iter.hasNext(); ) {
LocalRegion region = (LocalRegion) iter.next();
try {
if (region.getAttributes().getPoolName() != null && region.getAttributes().getPoolName().equals(qManager.getPool().getName())) {
// can this throw RDE??
region.handleMarker();
}
} catch (RegionDestroyedException e) {
// region is gone go to the next one bug 38705
continue;
}
}
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class GemFireMemberStatus method initializeRegionSizes.
protected void initializeRegionSizes() {
Iterator rootRegions = cache.rootRegions().iterator();
while (rootRegions.hasNext()) {
LocalRegion rootRegion = (LocalRegion) rootRegions.next();
if (!(rootRegion instanceof HARegion)) {
RegionStatus rootRegionStatus = rootRegion instanceof PartitionedRegion ? new PartitionedRegionStatus((PartitionedRegion) rootRegion) : new RegionStatus(rootRegion);
putRegionStatus(rootRegion.getFullPath(), rootRegionStatus);
Iterator subRegions = rootRegion.subregions(true).iterator();
while (subRegions.hasNext()) {
LocalRegion subRegion = (LocalRegion) subRegions.next();
RegionStatus subRegionStatus = subRegion instanceof PartitionedRegion ? new PartitionedRegionStatus((PartitionedRegion) subRegion) : new RegionStatus(subRegion);
putRegionStatus(subRegion.getFullPath(), subRegionStatus);
}
}
}
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class IndexUtils method getIndexManager.
public static IndexManager getIndexManager(Region region, boolean createIfNotAvailable) {
if (region == null || region.isDestroyed()) {
return null;
}
LocalRegion lRegion = (LocalRegion) region;
IndexManager idxMgr = lRegion.getIndexManager();
if (idxMgr == null && createIfNotAvailable) {
// JUst before creating new IndexManager.
if (testHook != null && region instanceof PartitionedRegion) {
testHook.hook(0);
}
Object imSync = lRegion.getIMSync();
synchronized (imSync) {
// Double checked locking
if (lRegion.getIndexManager() == null) {
idxMgr = new IndexManager(region);
lRegion.setIndexManager(idxMgr);
} else {
idxMgr = lRegion.getIndexManager();
}
}
}
return idxMgr;
}
use of org.apache.geode.internal.cache.LocalRegion in project geode by apache.
the class MemberMBeanBridge method getListOfRegions.
/**
* @return list of regions
*/
public String[] getListOfRegions() {
Set<LocalRegion> listOfAppRegions = cache.getApplicationRegions();
if (listOfAppRegions != null && listOfAppRegions.size() > 0) {
String[] regionStr = new String[listOfAppRegions.size()];
int j = 0;
for (LocalRegion rg : listOfAppRegions) {
regionStr[j] = rg.getFullPath();
j++;
}
return regionStr;
}
return ManagementConstants.NO_DATA_STRING;
}
Aggregations