/** * @throws org.apache.geode.cache.CacheRuntimeException if no cache created */ protected Region getRegion(DistributedSystem sys) { Cache cache = CacheFactory.getInstance(sys); return cache.getRegion(this.regionName); }
/** * This method creates cache. The cache created is a loner, so this is only suitable for single VM * tests. * */ public static synchronized InternalCache createCache() { if (cache == null) { Properties dsp = new Properties(); dsp.setProperty(MCAST_PORT, "0"); dsp.setProperty(LOCATORS, ""); DistributedSystem sys = DistributedSystem.connect(dsp); try { cache = (InternalCache) CacheFactory.create(sys); } catch (CacheExistsException exp) { cache = (InternalCache) CacheFactory.getInstance(sys); } catch (RegionExistsException rex) { cache = (InternalCache) CacheFactory.getInstance(sys); } } return cache; }
public static String init(DistributedSystem ds1, String className) throws Exception { System.out.println("Entering CacheUtils.init, DS is " + ds1); String tableName = ""; try { try { cache = CacheFactory.getInstance(ds1); } catch (CancelException cce) { cache = CacheFactory.create(ds1); } if (className != null && !className.equals("")) { String time = new Long(System.currentTimeMillis()).toString(); tableName = className + time; createTable(tableName); } } catch (Exception e) { e.printStackTrace(System.err); throw new Exception("Exception in CacheUtils::init, The Exception is " + e); } return tableName; }
/** * @throws org.apache.geode.cache.CacheRuntimeException if no cache created */ protected Region getRegion(DistributedSystem sys) { Cache cache = CacheFactory.getInstance(sys); Region r = cache.getRegion(regionName); if (r == null) { throw new RegionNotFoundException( String.format("Region %s not found in remote cache %s.", new Object[] {regionName, cache.getName()})); } return r; }
/** * Creates a new {@code CacheHealthEvaluator} */ CacheHealthEvaluator(GemFireHealthConfig config, DistributionManager dm) { super(config, dm); this.config = config; InternalDistributedSystem system = dm.getSystem(); InternalCache cache; try { cache = (InternalCache) CacheFactory.getInstance(system); } catch (CancelException ignore) { // No cache in this VM cache = null; } initialize(cache, dm); GemFireCacheImpl.addCacheLifecycleListener(this); }
RootRegionResponse m = new RootRegionResponse(); try { InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem()); final Collection roots; if (!Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "PRDebug")) {
/** * Returns a {@code FetchSysCfgResponse} that will be returned to the specified recipient. The * message will contains a copy of the local manager's config. */ public static RefreshMemberSnapshotResponse create(DistributionManager dm, InternalDistributedMember recipient) { RefreshMemberSnapshotResponse m = new RefreshMemberSnapshotResponse(); m.setRecipient(recipient); try { DistributedSystem sys = dm.getSystem(); InternalCache c = (InternalCache) CacheFactory.getInstance(sys); m.snapshot = new GemFireMemberStatus(c); } catch (Exception ignore) { m.snapshot = null; } return m; }
Cache cache = CacheFactory.getInstance(dm.getSystem());
void populateSnapshot(DistributionManager dm) { if (this.cancelled) { return; } DistributedSystem sys = dm.getSystem(); InternalCache cache = (InternalCache) CacheFactory.getInstance(sys); if (this.cancelled) { return; } RegionSubRegionSnapshot root = new RegionSubRegionSnapshot(); /* * This root exists only on admin side as a root of all root-region just to create a tree-like * structure */ root.setName("Root"); root.setParent(null); root.setEntryCount(0); Set rootRegions = cache.rootRegions(); this.snapshot = root; populateRegionSubRegions(root, rootRegions, cache); }