public MemoryHog(String n, Cache c, AtomicBoolean critical) { this.name = n; this.cache = c; this.tenuredData = new RegionFactory().setScope(Scope.LOCAL).create(this.name); this.criticalState = critical; }
@SuppressWarnings("unchecked") private LocalRegion createOrRetrieveGatewayDeltaRegion() { Region region = this.cache.getRegion(GatewayDelta.GATEWAY_DELTA_REGION_NAME); if (region == null) { region = new RegionFactory().setScope(Scope.LOCAL).setDataPolicy(DataPolicy.EMPTY) .setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)) // TODO: Disabled for WAN // .setEnableGateway(true) .addCacheListener(new GatewayDeltaEventApplicationCacheListener()) .create(GatewayDelta.GATEWAY_DELTA_REGION_NAME); } if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ") .append(region); this.cache.getLogger().fine(builder.toString()); } return (LocalRegion) region; }
factory.setScope(Scope.fromString(regionAttributes.getScope().name()));
public GemfireMetadataStore(Cache cache) { this(Objects.requireNonNull(cache, "'cache' must not be null") .<String, String>createRegionFactory() .setScope(Scope.LOCAL) .create(KEY)); }
public GemfireLockRegistry(Cache cache) { Assert.notNull(cache, "'cache' must not be null"); this.region = cache.createRegionFactory().setScope(Scope.GLOBAL).create(LOCK_REGISTRY_REGION); }
public static void main(String[] args) throws Exception { Properties props = new Properties(); props.setProperty("name", "CacheServer at " + new Date()); props.setProperty("log-level", "info"); logger.info("Connecting to the distributed system and creating the cache."); Cache cache = new CacheFactory(props).create(); // Create region. Region<?, ?> region = cache.createRegionFactory(RegionShortcut.REPLICATE) .setScope(Scope.DISTRIBUTED_ACK) .create("test"); logger.info("Test region, " + region.getFullPath() + ", created in cache."); // Start Cache Server. CacheServer server = cache.addCacheServer(); server.setPort(40404); logger.info("Starting server"); server.start(); ForkUtil.createControlFile(CacheServerProcess.class.getName()); logger.info("Waiting for shutdown"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); bufferedReader.readLine(); }
@BeforeClass public static void init() throws Exception { cacheFactoryBean = new CacheFactoryBean(); Cache cache = (Cache) cacheFactoryBean.getObject(); region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests"); }
@BeforeClass public static void startUp() throws Exception { cacheFactoryBean = new CacheFactoryBean(); cacheFactoryBean.afterPropertiesSet(); Cache cache = (Cache) cacheFactoryBean.getObject(); region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests"); }
@BeforeClass public static void init() throws Exception { cacheFactoryBean = new CacheFactoryBean(); cacheFactoryBean.afterPropertiesSet(); Cache cache = (Cache) cacheFactoryBean.getObject(); region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests"); }
@BeforeClass public static void startUp() throws Exception { cacheFactoryBean = new CacheFactoryBean(); cacheFactoryBean.afterPropertiesSet(); Cache cache = (Cache) cacheFactoryBean.getObject(); region = cache.createRegionFactory().setScope(Scope.LOCAL).create("sig-tests"); }
@SuppressWarnings("unchecked") private LocalRegion createOrRetrieveGatewayDeltaRegion() { Region region = this.cache.getRegion(GatewayDelta.GATEWAY_DELTA_REGION_NAME); if (region == null) { region = new RegionFactory().setScope(Scope.LOCAL).setDataPolicy(DataPolicy.EMPTY) .setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)) // TODO: Disabled for WAN // .setEnableGateway(true) .addCacheListener(new GatewayDeltaEventApplicationCacheListener()) .create(GatewayDelta.GATEWAY_DELTA_REGION_NAME); } if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ") .append(region); this.cache.getLogger().fine(builder.toString()); } return (LocalRegion) region; }
.thenAnswer(newSetter(regionTimeToLive, mockRegionFactory)); when(mockRegionFactory.setScope(any(Scope.class))).thenAnswer(newSetter(scope, mockRegionFactory));