/** * Adds a cache listener to the end of the list of cache listeners on this factory. * * @param aListener the cache listener to add * @return a reference to this RegionFactory object * @throws IllegalArgumentException if {@code aListener} is null * @see AttributesFactory#addCacheListener */ public RegionFactory<K, V> addCacheListener(CacheListener<K, V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
@Override public ClientRegionFactory<K, V> addCacheListener(CacheListener<K, V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception { new CacheServerTestUtil().createCache(dsProperties); IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException"); if (javaSystemProperties != null && javaSystemProperties.size() > 0) { Enumeration e = javaSystemProperties.propertyNames(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); System.setProperty(key, javaSystemProperties.getProperty(key)); } } PoolFactoryImpl pf = (PoolFactoryImpl) PoolManager.createFactory(); pf.init(poolAttr); PoolImpl p = (PoolImpl) pf.create("CacheServerTestUtil"); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(p.getName()); if (addControlListener.booleanValue()) { factory.addCacheListener(new ControlListener()); } RegionAttributes attrs = factory.create(); cache.createRegion(regionName, attrs); pool = p; }
private void createHARegion(String processedRegionName, InternalCache cache) throws IOException, ClassNotFoundException { AttributesFactory af = new AttributesFactory(); af.setMirrorType(MirrorType.KEYS_VALUES); af.addCacheListener(createCacheListenerForHARegion()); af.setStatisticsEnabled(true); RegionAttributes ra = af.create(); this.region = HARegion.getInstance(processedRegionName, cache, this, ra); if (isPrimary) {// fix for 41878 // since it's primary queue, we will disable the EntryExpiryTask // this should be done after region creation disableEntryExpiryTasks(); } }
requestedFactory.addCacheListener(new GatewayDeltaForwarderCacheListener(cache)); requestedFactory.addCacheListener(new DebugCacheListener()); requestedFactory.addCacheListener(new SessionExpirationCacheListener());
factory.addCacheListener(listener);
factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); factory.addCacheListener(new FixedPartitionAttributesListener()); if (Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "PRDebug")) { factory.addCacheListener(new CacheListenerAdapter() { @Override public void afterCreate(EntryEvent event) {
public void afterInvalidate2(EntryEvent e) {} }; factory.addCacheListener(list); RegionAttributes attrs = factory.create();
public void afterInvalidate2(EntryEvent e) {} }; factory.addCacheListener(list); RegionAttributes attrs = factory.create();
private Region<String, RegionConfiguration> createRegionConfigurationMetadataRegion() { // a sessionFactory in hibernate could have been re-started // so, it is possible that this region exists already Region<String, RegionConfiguration> r = this.cache.getRegion(REGION_CONFIGURATION_METADATA_REGION); if (r != null) { return r; } GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache; InternalRegionArguments ira = new InternalRegionArguments().setInternalRegion(true); AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.REPLICATE); af.setScope(Scope.DISTRIBUTED_ACK); af.addCacheListener(new RegionConfigurationCacheListener()); RegionAttributes ra = af.create(); try { return gemFireCache.createVMRegion(REGION_CONFIGURATION_METADATA_REGION, ra, ira); } catch (IOException | ClassNotFoundException e) { InternalGemFireError assErr = new InternalGemFireError( "unexpected exception"); assErr.initCause(e); throw assErr; } }
public void afterInvalidate2(EntryEvent e) {} }; factory.addCacheListener(list); RegionAttributes attrs = factory.create();
factory.addCacheListener(null); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { assertEquals(Arrays.asList(new CacheListener[0]), Arrays.asList(ra.getCacheListeners())); factory.addCacheListener(cl1); ra = factory.create(); assertEquals(Arrays.asList(new CacheListener[] {cl1}), Arrays.asList(ra.getCacheListeners())); factory.addCacheListener(cl2); ra = factory.create(); assertEquals(Arrays.asList(new CacheListener[] {cl1, cl2}),
factory.addCacheListener(list); RegionAttributes attrs = factory.create();
/** * This method creates the client health monitoring region. * <p> * GuardedBy ClientHealthMonitoringRegion.class * * @param cache The current GemFire Cache */ private static void initialize(InternalCache cache) { try { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setEntryTimeToLive( new ExpirationAttributes(ADMIN_REGION_EXPIRY_INTERVAL, ExpirationAction.DESTROY)); cache.getLogger().fine("ClientHealthMonitoringRegion, setting TTL for entry...."); factory.addCacheListener(prepareCacheListener()); factory.setValueConstraint(ClientHealthStats.class); factory.setStatisticsEnabled(true); RegionAttributes regionAttrs = factory.create(); InternalRegionArguments internalArgs = new InternalRegionArguments(); internalArgs.setIsUsedForMetaRegion(true); internalArgs.setIsUsedForPartitionedRegionAdmin(false); currentInstance = cache.createVMRegion(ADMIN_REGION_NAME, regionAttrs, internalArgs); } catch (Exception ex) { cache.getLogger().error( "Error while creating an admin region", ex); } }
public void afterInvalidate2(EntryEvent e) {} }; factory.addCacheListener(list); RegionAttributes attrs = factory.create();
factory.addCacheListener(list); RegionAttributes attrs = factory.create();
factory.addCacheListener(list); RegionAttributes attrs = factory.create();
factory.addCacheListener(list); RegionAttributes attrs = factory.create();
af.addCacheListener(metaListener); af.setDataPolicy(DataPolicy.REPLICATE); InternalRegionArguments ira =
factory.addCacheListener(new CacheListenerAdapter<Object, Object>() { @Override public void afterCreate(EntryEvent<Object, Object> event) {