public static Cache getCacheIfExists() { Cache cache; try { cache = CacheFactory.getAnyInstance(); } catch (CacheClosedException e) { //ignore & return null cache = null; } return cache; }
public static Cache getCacheIfExists() { Cache cache; try { cache = CacheFactory.getAnyInstance(); } catch (CacheClosedException e) { //ignore & return null cache = null; } return cache; }
public Region<?, ?> getRegion() { // The region will be null mostly for the other node where the gateway event // is serialized return this.region != null ? this.region : CacheFactory.getAnyInstance() .getRegion(this.regionPath); }
/** * Returns the region with the given name in the current cache, or null if * no region with that name exists. */ public static synchronized Region getRegion(String regionName) { if (regionName == null) { throw new IllegalArgumentException("regionName cannot be null"); } return CacheFactory.getAnyInstance().getRegion(regionName); }
public void run2() throws CacheException { Cache cache2 = CacheFactory.getAnyInstance(); cache2.close(); } });
public void run() { Cache c = CacheFactory.getAnyInstance(); List bslist = c.getBridgeServers(); assertEquals(2, bslist.size()); BridgeServer bs = (BridgeServer)bslist.get(0); bs.stop(); } };
public void run() { Cache c = CacheFactory.getAnyInstance(); List bslist = c.getBridgeServers(); assertEquals(2, bslist.size()); BridgeServer bs = (BridgeServer)bslist.get(0); bs.stop(); } };
/** * Prints all the root regions in the cache. Helps while * debugging reconnect issues with integrity problems. * */ public static void printRegions() throws Exception { Cache cache = (GemFireCacheImpl)CacheFactory.getAnyInstance(); Set roots = cache.rootRegions(); Iterator it = roots.iterator(); while (it.hasNext()){ Log.getLogWriter().info("ROOT XXXX : "+it.next()); } }
/** * Creates a AggregatorPeer object with the specified region path. * @param regionFullPath The full path of the partitioned region on * which aggregation operations are to be executed. */ public AggregatorPeer(String regionFullPath) { Cache cache = CacheFactory.getAnyInstance(); region = (PartitionedRegion)cache.getRegion(regionFullPath); init(); }
static public DistributedMember getMyName() { Cache cache2; try { cache2 = CacheFactory.getAnyInstance(); } catch (CancelException e) { return null; } DistributedMember result = cache2.getDistributedSystem().getDistributedMember(); return result; }
@Override public Object call() throws Exception { Cache cache = CacheFactory.getAnyInstance(); Region r = cache.getRegion("/REG1"); assertEquals(10, r.size()); for(int i = 0; i < 10; i++) { assertTrue(r.containsKey("name"+i)); assertEquals("value"+i, r.get("name"+i)); } return null; } });
public PdxListHelper(PdxListHelper parent, String name) { GemFireCacheImpl gci = (GemFireCacheImpl)CacheFactory.getAnyInstance(); logger = gci.getLoggerI18n(); m_name = name; if(logger.finerEnabled()) { logger.finer("PdxListHelper name: " + name ); } m_parent = parent; }
@Override public Object call() throws Exception { Cache cache = CacheFactory.getAnyInstance(); Region r = cache.getRegion("/REG1"); for(int i = 0; i < 10; i++) { r.put("name"+i, "value"+i); } Region reg1 = cache.getRegion("/REG1"); assertEquals(10, r.size()); return null; } });
@Override public void run2() throws CacheException { Region repRegion = CacheFactory.getAnyInstance().getRegion(repRegionName); IndexManager.testHook = new IndexManagerTestHook(); // This portfolio with same ID must have different positions. repRegion.put(new Integer("1"), new Portfolio(1)); //above call must be hooked in BEFORE_UPDATE_OP call. } });
public PdxInstanceHelper(String className , PdxInstanceHelper parent) { GemFireCacheImpl gci = (GemFireCacheImpl)CacheFactory.getAnyInstance(); logger = gci.getLoggerI18n(); if(logger.finerEnabled()) { logger.finer("ClassName " + className ); } m_PdxName = className; m_parent = parent; m_pdxInstanceFactory = (PdxInstanceFactoryImpl)gci.createPdxInstanceFactory(JSONFormatter.JSON_CLASSNAME, false); }
public static Set getCacheClientProxies() { Cache c = CacheFactory.getAnyInstance(); assertEquals("More than one BridgeServer", 1, c.getBridgeServers().size()); BridgeServerImpl bs = (BridgeServerImpl)c.getBridgeServers().iterator() .next(); assertNotNull(bs); assertNotNull(bs.getAcceptor()); assertNotNull(bs.getAcceptor().getCacheClientNotifier()); return new HashSet(bs.getAcceptor().getCacheClientNotifier().getClientProxies()); }
private Map simulate() throws CancellationException, InterruptedException { Cache cache = CacheFactory.getAnyInstance(); ResourceManager manager = cache.getResourceManager(); RebalanceOperation op = manager.createRebalanceFactory().simulate(); RebalanceResults results = op.getResults(); Set<PartitionRebalanceInfo> set = results.getPartitionRebalanceDetails(); return convertToMap(results); }
@Override public void run2() throws CacheException { try { Cache cache = CacheFactory.getAnyInstance(); cache.getQueryService().removeIndexes(); cache.getRegion(name).clear(); cache.getQueryService().createIndex("idIndex", "p.ID", "/"+name+" p"); } catch (Exception e) { fail("index creation failed", e); } } });
public void createPR() { PartitionResolver testKeyBasedResolver = new QueryAPITestPartitionResolver(); cache = CacheFactory.getAnyInstance(); cache .createRegionFactory(RegionShortcut.PARTITION_REDUNDANT) .setPartitionAttributes( new PartitionAttributesFactory() .setTotalNumBuckets(numOfBuckets) .setPartitionResolver(testKeyBasedResolver) .create()) .create(PartitionedRegionName1); }
@Override public void execute(FunctionContext context) { Object object = context.getArguments(); Cache cache = CacheFactory.getAnyInstance(); @SuppressWarnings("rawtypes") Region region = cache.getRegion(COMMON_REGION); String id = cache.getDistributedSystem().getDistributedMember().getName(); region.put(id, object); Log.getLogWriter().info("Completed executeFunction on member : " + id); context.getResultSender().lastResult(true); }