/** function to create client cache * */ public static void createClientCache1(String host, Integer port1) throws Exception { PORT1 = port1.intValue(); Properties props = new Properties(); props.setProperty("mcast-port", "0"); props.setProperty("locators", ""); new PutAllDUnitTest("temp").createCache(props); props.setProperty("retryAttempts", "2"); props.setProperty("endpoints", "ep1=" + host + ":" + PORT1); props.setProperty("redundancyLevel", "-1"); props.setProperty("establishCallbackConnection", "true"); props.setProperty("LBPolicy", "Sticky"); props.setProperty("readTimeout", "2000"); props.setProperty("socketBufferSize", "1000"); props.setProperty("retryInterval", "250"); props.setProperty("connectionsPerServer", "2"); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); PoolImpl p = (PoolImpl) ClientServerTestCase.configureConnectionPool( factory, host, PORT1, -1, true, -1, 2, null); CacheListener clientListener = new HAEventIdPropagationListenerForClient1(); factory.setCacheListener(clientListener); RegionAttributes attrs = factory.create(); cache.createRegion(REGION_NAME, attrs); Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME); assertNotNull(region); region.registerInterest("ALL_KEYS", InterestResultPolicy.NONE); pool = p; }
/** * Register interest with ALL_KEYS, and InterestPolicyResult = KEYS_VALUES which is equivalent to * a full GII. * * @param aRegion The region to register interest on. */ protected static void registerInterest(Region aRegion) { Log.getLogWriter() .info("Calling registerInterest for all keys, result interest policy KEYS_VALUES"); aRegion.registerInterest("ALL_KEYS", InterestResultPolicy.KEYS_VALUES); Log.getLogWriter() .info( "Done calling registerInterest for all keys, " + "result interest policy KEYS_VALUES, " + aRegion.getFullPath() + " size is " + aRegion.size()); }
/** @param key Key in which client is interested */ public static void registerKey1() { try { Region r = cache.getRegion(Region.SEPARATOR + REGION_NAME); assertNotNull(r); List list = new ArrayList(); list.add("key1"); r.registerInterest(list); } catch (Exception ex) { fail("failed while registering interest", ex); } }
protected void postProcess(Region<K, V> region) { if (!ObjectUtils.isEmpty(interests)) { for (Interest<K> interest : interests) { if (interest instanceof RegexInterest) { // do the cast since it's safe region.registerInterestRegex( (String) interest.getKey(), interest.getPolicy(), interest.isDurable(), interest.isReceiveValues()); } else { region.registerInterest( interest.getKey(), interest.getPolicy(), interest.isDurable(), interest.isReceiveValues()); } } } }