public static void createCacheClientFromXml(URL url, String poolName, String durableClientId, int timeout, Boolean addControlListener) { ClientCacheFactory ccf = new ClientCacheFactory(); try { File cacheXmlFile = new File(url.toURI().getPath()); ccf.set(CACHE_XML_FILE, cacheXmlFile.toURI().getPath()); } catch (URISyntaxException e) { throw new ExceptionInInitializerError(e); } ccf.set(MCAST_PORT, "0"); ccf.set(DURABLE_CLIENT_ID, durableClientId); ccf.set(DURABLE_CLIENT_TIMEOUT, String.valueOf(timeout)); cache = (Cache) ccf.create(); expected = IgnoredException .addIgnoredException("java.net.ConnectionException||java.net.SocketException"); pool = (PoolImpl) PoolManager.find(poolName); }
private ClientCache connectToLocallyRunningGeode() { ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334) .setPoolSubscriptionEnabled(true).set("log-level", "WARN").create(); return cache; }
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") .setPdxSerializer( new ReflectionBasedAutoSerializer("org.apache.geode_examples.serialization.Country")) .create(); // create a local region that matches the server region Region<String, Country> region = cache.<String, Country>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); Example example = new Example(region); example.insertValues(); example.printValues(example.getKeys()); cache.close(); }
public static void createCacheClientFromXmlN(URL url, String poolName, String durableClientId, int timeout, Boolean addControlListener) { ClientCacheFactory ccf = new ClientCacheFactory(); try { File cacheXmlFile = new File(url.toURI().getPath()); ccf.set(CACHE_XML_FILE, cacheXmlFile.toURI().getPath()); } catch (URISyntaxException e) { throw new ExceptionInInitializerError(e); } ccf.set(MCAST_PORT, "0"); ccf.set(DURABLE_CLIENT_ID, durableClientId); ccf.set(DURABLE_CLIENT_TIMEOUT, String.valueOf(timeout)); ccf.set(LOG_FILE, "abs_client_system.log"); ccf.set(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel()); cache = (Cache) ccf.create(); expected = IgnoredException .addIgnoredException("java.net.ConnectionException||java.net.SocketException"); pool = (PoolImpl) PoolManager.find(poolName); }
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(); // 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(); 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, Integer> region = cache.<String, Integer>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); Example example = new Example(region); final int previous = example.getCounter(); example.increment(); final int current = example.getCounter(); System.out.println(previous + " -> " + current); 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<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 ClientRegionFactory<String, Integer> clientRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY); Region<String, Integer> region = clientRegionFactory.create(REGION_NAME); Example example = new Example(region); example.initializeEntry(); example.executeChildProcesses(5); cache.close(); }
public static void main(String[] args) throws InterruptedException, 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<String, TrainStop> region = cache.<String, TrainStop>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); LuceneService luceneService = LuceneServiceProvider.get(cache); // Add some entries into the region putEntries(luceneService, region); findNearbyTrainStops(luceneService); 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(); }
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.insertValues(region, example.generateIntegers(10)); example.monitorEntries(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.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 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<EmployeeKey, EmployeeData> region = cache.<EmployeeKey, EmployeeData>createClientRegionFactory(ClientRegionShortcut.PROXY) .create("example-region"); Example example = new Example(region); example.insertValues(new String[] {"Alex Able", "Bertie Bell", "Chris Call", "Dale Driver", "Frankie Forth", "Jamie Jive", "Morgan Minnow", "Pat Pearson", "Ricky Reliable", "Taylor Tack", "Zelda Zankowski"}); example.printValues(example.getValues()); cache.close(); }
public static void main(String[] args) { // connect to the locator using default port 10334 ClientCache cache = new ClientCacheFactory().set("log-level", "WARN").create(); final String poolName = "subscriptionPool"; PoolManager.createFactory().addLocator("127.0.0.1", 10334).setSubscriptionEnabled(true) .create(poolName); // create a local region that matches the server region final ClientRegionFactory<Integer, String> incomingRegionFactory = cache.<Integer, String>createClientRegionFactory(ClientRegionShortcut.PROXY); Region<Integer, String> incomingRegion = incomingRegionFactory.setPoolName(poolName).create(INCOMING_REGION_NAME); // create another local region that matches the server region final ClientRegionFactory<String, String> outgoingRegionFactory = cache.<String, String>createClientRegionFactory(ClientRegionShortcut.PROXY); Region<String, String> outgoingRegion = outgoingRegionFactory.setPoolName(poolName).create(OUTGOING_REGION_NAME); new Example().checkWords(incomingRegion, outgoingRegion, Arrays.asList(new String[] {"that", "teh", "wil", "i'"})); cache.close(); }