private HARegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion, InternalCache cache) { super(regionName, attrs, parentRegion, cache, new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false) .setSnapshotInputStream(null).setImageTarget(null)); this.haRegionStats = new DummyCachePerfStats(); }
/** * * Returns an instance of HARegion after it has properly initialized * * @param regionName name of the region to be created * @param cache the cache that owns this region * @param ra attributes of the region * @return an instance of an HARegion * @throws RegionExistsException if a region of the same name exists in the same Cache */ public static HARegion getInstance(String regionName, InternalCache cache, HARegionQueue hrq, RegionAttributes ra) throws TimeoutException, RegionExistsException, IOException, ClassNotFoundException { HARegion haRegion = new HARegion(regionName, ra, null, cache); haRegion.setOwner(hrq); Region region = cache.createVMRegion(regionName, ra, new InternalRegionArguments().setInternalMetaRegion(haRegion).setDestroyLockFlag(true) .setSnapshotInputStream(null).setInternalRegion(true).setImageTarget(null)); return (HARegion) region; }
@Override protected CacheDistributionAdvisor createDistributionAdvisor( InternalRegionArguments internalRegionArgs) { return internalRegionArgs.getBucketAdvisor(); }
public ParallelGatewaySenderQueueMetaRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion, InternalCache cache, AbstractGatewaySender pgSender) { super(regionName, attrs, parentRegion, cache, new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false) .setSnapshotInputStream(null).setImageTarget(null) .setIsUsedForParallelGatewaySenderQueue(true) .setParallelGatewaySender((AbstractGatewaySender) pgSender)); this.sender = (AbstractGatewaySender) pgSender; }
protected SerialGatewaySenderQueueMetaRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion, InternalCache cache, AbstractGatewaySender sender) { super(regionName, attrs, parentRegion, cache, new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false) .setSnapshotInputStream(null).setImageTarget(null) .setIsUsedForSerialGatewaySenderQueue(true).setSerialGatewaySender(sender)); this.sender = sender; }
try { this.region = gemCache.createVMRegion(this.regionName, ra, new InternalRegionArguments().setInternalMetaRegion(meta).setDestroyLockFlag(true) .setSnapshotInputStream(null).setImageTarget(null) .setIsUsedForSerialGatewaySenderQueue(true).setInternalRegion(true) .setSerialGatewaySender(sender));
@Test public void createVMRegionWithInternalRegionThrows() throws Exception { assertThatThrownBy(() -> { cache.createVMRegion(null, null, new InternalRegionArguments().setInternalRegion(true)); }).isInstanceOf(NotAuthorizedException.class); }
final Bucket proxyBucket = this.partitionedRegion.getRegionAdvisor().getBucket(bucketId); bucketRegion = (BucketRegion) rootRegion.createSubregion(bucketRegionName, attributes, new InternalRegionArguments() .setPartitionedRegionBucketRedundancy(this.partitionedRegion.getRedundantCopies()) .setBucketAdvisor(proxyBucket.getBucketAdvisor()) .setPersistenceAdvisor(proxyBucket.getPersistenceAdvisor()) .setDiskRegion(proxyBucket.getDiskRegion()).setCachePerfStatsHolder(this) .setLoaderHelperFactory(this.partitionedRegion) .setPartitionedRegion(this.partitionedRegion) .setIndexes(getIndexes(rootRegion.getFullPath(), bucketRegionName))); this.partitionedRegion.getPrStats().incBucketCount(1); } catch (RegionExistsException ex) {
InternalRegionArguments ira = new InternalRegionArguments().setIsUsedForMetaRegion(true) .setCachePerfStatsHolder(statsHolder);
@Test public void createVMRegionWithUsedForMetaRegionThrows() throws Exception { assertThatThrownBy(() -> { cache.createVMRegion(null, null, new InternalRegionArguments().setIsUsedForMetaRegion(true)); }).isInstanceOf(NotAuthorizedException.class); }
public static BucketRegionQueue createBucketRegionQueue(GemFireCacheImpl cache, PartitionedRegion parentRegion, PartitionedRegion queueRegion, int bucketId) { InternalRegionArguments ira = new InternalRegionArguments(); ira.setPartitionedRegion(queueRegion); ira.setPartitionedRegionBucketRedundancy(1); BucketAdvisor ba = mock(BucketAdvisor.class); ira.setBucketAdvisor(ba); InternalRegionArguments pbrIra = new InternalRegionArguments(); RegionAdvisor ra = mock(RegionAdvisor.class); when(ra.getPartitionedRegion()).thenReturn(queueRegion); pbrIra.setPartitionedRegionAdvisor(ra); PartitionAttributes pa = mock(PartitionAttributes.class); when(queueRegion.getPartitionAttributes()).thenReturn(pa);
regionAttrsFactory.setDiskStoreName(CLUSTER_CONFIG_DISK_STORE_NAME); regionAttrsFactory.setScope(Scope.DISTRIBUTED_ACK); InternalRegionArguments internalArgs = new InternalRegionArguments(); internalArgs.setIsUsedForMetaRegion(true); internalArgs.setMetaRegionWithTransactions(false);
if (internalRegionArgs.getPartitionedRegion() != null) { myName = internalRegionArgs.getPartitionedRegion().getFullPath(); if (internalRegionArgs.getUserAttribute() != null) { setUserAttribute(internalRegionArgs.getUserAttribute()); if (internalRegionArgs.getCachePerfStatsHolder() != null) { this.hasOwnStats = false; this.cachePerfStats = internalRegionArgs.getCachePerfStatsHolder().getCachePerfStats(); } else { if (attrs.getPartitionAttributes() != null || isInternalRegion() || internalRegionArgs.isUsedForMetaRegion()) { this.hasOwnStats = false; this.cachePerfStats = cache.getCachePerfStats(); if (internalRegionArgs.getLoaderHelperFactory() != null) { this.loaderHelperFactory = internalRegionArgs.getLoaderHelperFactory(); } else { this.loaderHelperFactory = this; this.isUsedForPartitionedRegionAdmin = internalRegionArgs.isUsedForPartitionedRegionAdmin(); this.isUsedForPartitionedRegionBucket = internalRegionArgs.isUsedForPartitionedRegionBucket(); this.isUsedForMetaRegion = internalRegionArgs.isUsedForMetaRegion(); this.isMetaRegionWithTransactions = internalRegionArgs.isMetaRegionWithTransactions(); this.isUsedForSerialGatewaySenderQueue = internalRegionArgs.isUsedForSerialGatewaySenderQueue(); this.isUsedForParallelGatewaySenderQueue = internalRegionArgs.isUsedForParallelGatewaySenderQueue(); this.serialGatewaySender = internalRegionArgs.getSerialGatewaySender(); if (internalRegionArgs.getCacheServiceProfiles() != null) {
new InternalRegionArguments().setIsUsedForPartitionedRegionAdmin(true) .setInternalRegion(true).setCachePerfStatsHolder(prMetaStatsHolder)); root.getDistributionAdvisor().addMembershipListener(new MemberFailureListener(cache)); } catch (RegionExistsException ignore) {
af.setDataPolicy(DataPolicy.REPLICATE); InternalRegionArguments ira = new InternalRegionArguments().setInternalRegion(true).setIsUsedForMetaRegion(true); redisMetaData = gemFireCache.createVMRegion(REDIS_META_DATA_REGION, af.create(), ira);
protected DistributedMetaRegion(RegionAttributes attrs) { super(DYNAMIC_REGION_LIST_NAME, attrs, null, DynamicRegionFactory.this.cache, new InternalRegionArguments()); }
@Override public Region createSubregion(String subregionName, RegionAttributes aRegionAttributes) throws RegionExistsException, TimeoutException { try { return createSubregion(subregionName, aRegionAttributes, new InternalRegionArguments().setDestroyLockFlag(true).setRecreateFlag(false)); } catch (IOException | ClassNotFoundException e) { // only happens when loading a snapshot, not here throw new InternalGemFireError( "unexpected exception", e); } }
/** * 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); } }
@Test public void createVMRegionWithUsedForParallelGatewaySenderQueueThrows() throws Exception { assertThatThrownBy(() -> { cache.createVMRegion(null, null, new InternalRegionArguments().setIsUsedForParallelGatewaySenderQueue(true)); }).isInstanceOf(NotAuthorizedException.class); }
@Test public void createVMRegionWithUsedForSerialGatewaySenderQueueThrows() throws Exception { assertThatThrownBy(() -> { cache.createVMRegion(null, null, new InternalRegionArguments().setIsUsedForSerialGatewaySenderQueue(true)); }).isInstanceOf(NotAuthorizedException.class); }