@Deprecated public static Region createProxyRegion(ClientCache cache, String regionName) { return cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(regionName); }
public Region createProxyRegion(String regionPath) { return cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create(regionPath); }
private Region<String, HttpSession> createLocalSessionRegion() { ClientRegionFactory<String, HttpSession> factory = null; boolean enableLocalCache = (Boolean) properties.get(CacheProperty.ENABLE_LOCAL_CACHE); String regionName = (String) properties.get(CacheProperty.REGION_NAME); if (enableLocalCache) { // Create the region factory with caching and heap LRU enabled factory = this.cache .<String, HttpSession>createClientRegionFactory( ClientRegionShortcut.CACHING_PROXY_HEAP_LRU) .setCustomEntryIdleTimeout(new SessionCustomExpiry()); LOG.info("Created new local client session region: {}", regionName); } else { // Create the region factory without caching enabled factory = this.cache.createClientRegionFactory(ClientRegionShortcut.PROXY); LOG.info("Created new local client (uncached) session region: {} without any session expiry", regionName); } // Create the region return factory.create(regionName); } }
@Override public Object call() throws Exception { ClientRegionFactory factory = ((ClientCache) getCache()) .createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY); if (valueConstraint != null) { factory.setValueConstraint(valueConstraint); } factory.create(regionName); return true; } });
private Region<String, PdxInstance> getRegion(String table) { Region<String, PdxInstance> r = cache.getRegion(table); if (r == null) { try { if (isClient) { ClientRegionFactory<String, PdxInstance> crf = ((ClientCache) cache).createClientRegionFactory(ClientRegionShortcut.PROXY); r = crf.create(table); } else { RegionFactory<String, PdxInstance> rf = ((Cache) cache).createRegionFactory(RegionShortcut.PARTITION); r = rf.create(table); } } catch (RegionExistsException e) { // another thread created the region r = cache.getRegion(table); } } return r; } }
@Test public void serverUsesFilteredCache() { serverVM.invoke(() -> { Cache serverCache = (Cache) cache; serverCache.createRegionFactory(RegionShortcut.REPLICATE).create("region"); }); clientVM.invoke(() -> { ClientCache clientCache = (ClientCache) cache; Region<String, String> region = clientCache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("region"); region.put("Object1", "Value1"); }); serverVM.invoke(() -> { Cache serverCache = (Cache) cache; CacheServer server = serverCache.getCacheServers().stream().findFirst().get(); CacheServerImpl impl = (CacheServerImpl) server; assertThat(impl.getAcceptor().getCachedRegionHelper().getCache()) .isInstanceOf(InternalCacheForClientAccess.class); }); }
@Test(expected = GemFireConfigException.class) public void clientIsPreventedFromConnectingToLocatorAsServer() { IgnoredException.addIgnoredException("Improperly configured client detected"); ClientCacheFactory clientCacheFactory = new ClientCacheFactory(); clientCacheFactory.addPoolServer("localhost", DistributedTestUtils.getDUnitLocatorPort()); clientCacheFactory.setPoolSubscriptionEnabled(true); getClientCache(clientCacheFactory); Region region = ((ClientCache) cache).createClientRegionFactory(ClientRegionShortcut.PROXY) .create(REGION_NAME1); region.registerInterest(k1); }
private void testAllOperations() { ClientCache clientCache = (ClientCache) cache; Region<String, String> region = clientCache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("internalRegion"); assertFailure(() -> region.create("Object1", "Value1")); assertFailure(() -> region.put("Object1", "Value1")); assertFailure(() -> region.putIfAbsent("Object1", "Value1")); assertFailure(() -> region.get("Object1")); Map<String, String> map = new HashMap<>(); map.put("Object1", "Value1"); assertFailure(() -> region.putAll(map)); List<String> list = new ArrayList<>(); list.add("Object1"); assertFailure(() -> region.getAll(list)); assertFailure(() -> region.removeAll(list)); assertFailure(() -> region.destroy("Object1")); assertFailure(() -> region.remove("Object1")); assertFailure(() -> region.replace("Object1", "oldValue", "newValue")); assertFailure(() -> region.invalidate("Object1")); assertFailure(region::keySetOnServer); assertFailure(() -> region.registerInterest("Object1")); }
cc.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create(regionName); pool = (PoolImpl) ((GemFireCacheImpl) cc).getDefaultPool();
Region region = factory.create(getSessionManager().getRegionName());
private void init() throws CqException, RegionNotFoundException, CqExistsException { // init cache, region, and CQ // connect to the locator using default port 10334 this.cache = connectToLocallyRunningGeode(); // create a local region that matches the server region this.region = cache.<Integer, Integer>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); this.randomTracker = this.startCQ(this.cache, this.region); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region ClientRegionFactory<String, Integer> clientRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY); Region<String, Integer> region = clientRegionFactory.create(Example.REGION_NAME); Incrementer incrementer = new Incrementer(Integer.parseInt(args[0]), cache, region); incrementer.incrementEntry(); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<String, String> region = cache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("example-region"); printQuotes(region); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); Example example = new Example(); // create a local region that matches the server region ClientRegionFactory<Integer, String> clientRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY); Region<Integer, String> region = clientRegionFactory.create("example-region"); example.putEntries(region); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); Example example = new Example(); // create a local region that matches the server region ClientRegionFactory<Integer, String> clientRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY); Region<Integer, String> region = clientRegionFactory.create("example-region"); example.putEntries(region); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<String, String> region = cache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("example-region"); new Example().getValidNames(region); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<Integer, String> region = cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("example-region"); Execution execution = FunctionService.onRegion(region); new Example().getPrimes(region, execution); cache.close(); }
public static void main(String[] args) throws LuceneQueryException { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<Integer, EmployeeData> region = cache.<Integer, EmployeeData>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY) .create("example-region"); insertValues(region); query(cache); queryNestedObject(cache); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<Integer, String> region = cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); Example example = new Example(region); example.insertValues(10); example.printValues(example.getValues()); cache.close(); }
public static void main(String[] args) { // connect to the locator in London cluster using port 10332 ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10332) .set("log-level", "WARN").create(); // create a local region that matches the server region Region<Integer, String> region = cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); Example example = new Example(region); example.insertValues(10); example.printValues(example.getValues()); cache.close(); }