本文整理了Java中org.apache.geode.cache.RegionAttributes.getScope
方法的一些代码示例,展示了RegionAttributes.getScope
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RegionAttributes.getScope
方法的具体详情如下:
包路径:org.apache.geode.cache.RegionAttributes
类名称:RegionAttributes
方法名:getScope
[英]Returns the scope of the region. Default scope is DISTRIBUTED_NO_ACK. Please refer the gemfire documentation for more details on this.
[中]返回区域的范围。默认作用域是分布式的。有关这方面的更多细节,请参阅gemfire文档。
代码示例来源:origin: apache/geode
@Override
public Scope getScope() {
return this.ra.getScope();
}
代码示例来源:origin: apache/geode
/**
* validate attributes of subregion being created, sent to parent
*
* @throws IllegalArgumentException if attrs is null
* @throws IllegalStateException if attributes are invalid
*/
private void validateSubregionAttributes(RegionAttributes attrs) {
if (attrs == null) {
throw new IllegalArgumentException(
"region attributes must not be null");
}
if (this.scope == Scope.LOCAL && attrs.getScope() != Scope.LOCAL) {
throw new IllegalStateException(
"A region with Scope.LOCAL can only have subregions with Scope.LOCAL");
}
}
代码示例来源:origin: apache/geode
protected LocalMetaRegion(RegionAttributes attrs, InternalRegionArguments ira) {
super(DYNAMIC_REGION_LIST_NAME, attrs, null, DynamicRegionFactory.this.cache, ira);
Assert.assertTrue(attrs.getScope().isLocal());
}
代码示例来源:origin: apache/geode
/**
* This implementation only checks readiness and scope
*/
@Override
public Lock getRegionDistributedLock() throws IllegalStateException {
checkReadiness();
checkForLimitedOrNoAccess();
Scope theScope = getAttributes().getScope();
Assert.assertTrue(theScope == Scope.LOCAL);
throw new IllegalStateException(
"Only supported for GLOBAL scope, not LOCAL");
}
代码示例来源:origin: apache/geode
/**
* This implementation only checks readiness and scope
*/
@Override
public Lock getDistributedLock(Object key) throws IllegalStateException {
checkReadiness();
checkForLimitedOrNoAccess();
Scope theScope = getAttributes().getScope();
Assert.assertTrue(theScope == Scope.LOCAL);
throw new IllegalStateException(
"Only supported for GLOBAL scope, not LOCAL");
}
代码示例来源:origin: apache/geode
/************** Public Methods ************************/
Object doNetSearch() throws TimeoutException {
resetResults();
RegionAttributes attrs = region.getAttributes();
this.requestInProgress = true;
Scope scope = attrs.getScope();
Assert.assertTrue(scope != Scope.LOCAL);
netSearchForBlob();
this.requestInProgress = false;
return this.result;
}
代码示例来源:origin: apache/geode
@Test
public void testExecuteWithRegions() throws Exception {
when(cache.rootRegions()).thenReturn(regions);
when(region.getFullPath()).thenReturn("/MyRegion");
when(region.getParentRegion()).thenReturn(null);
when(region.subregions(true)).thenReturn(subregions);
when(region.subregions(false)).thenReturn(subregions);
when(region.getAttributes()).thenReturn(regionAttributes);
when(regionAttributes.getDataPolicy()).thenReturn(mock(DataPolicy.class));
when(regionAttributes.getScope()).thenReturn(mock(Scope.class));
regions.add(region);
getRegionsFunction.execute(functionContext);
}
代码示例来源:origin: apache/geode
protected void checkVersionTag(DistributedRegion rgn, VersionTag tag) {
RegionAttributes attr = rgn.getAttributes();
if (attr.getConcurrencyChecksEnabled() && attr.getDataPolicy().withPersistence()
&& attr.getScope() != Scope.GLOBAL
&& (tag.getMemberID() == null || test_InvalidVersion)) {
if (logger.isDebugEnabled()) {
logger.debug("Version tag is missing the memberID: {}", tag);
}
String msg =
String.format("memberID cannot be null for persistent regions: %s", tag);
RuntimeException ex = (sender.getVersionObject().compareTo(Version.GFE_80) < 0)
? new InternalGemFireException(msg) : new InvalidVersionException(msg);
throw ex;
}
}
代码示例来源:origin: apache/geode
/**
* Tests that {@link Region#get} returns <code>null</code> when there is no remote loader.
*/
@Test
public void testNoRemoteCacheLoader() {
assertThat(getRegionAttributes().getScope().isDistributed()).isTrue();
final String name = this.getUniqueName();
final Object key = "KEY";
SerializableRunnable create = new CacheSerializableRunnable("Create Region") {
@Override
public void run2() throws CacheException {
createRegion(name);
}
};
final VM vm0 = VM.getVM(0);
final VM vm1 = VM.getVM(1);
vm0.invoke(create);
vm1.invoke(create);
vm0.invoke(new CacheSerializableRunnable("Remote load") {
@Override
public void run2() throws CacheException {
Region<Object, Object> region = getRootRegion().getSubregion(name);
assertThat(region.get(key)).isNull();
}
});
}
代码示例来源:origin: apache/geode
/**
* Tests that doing a distributed get results in a <code>netSearch</code>.
*/
@Test
public void testDistributedGet() {
assertThat(getRegionAttributes().getScope().isDistributed()).isTrue();
final String name = this.getUniqueName();
final Object key = "KEY";
final Object value = "VALUE";
VM vm0 = VM.getVM(0);
VM vm1 = VM.getVM(1);
vm0.invoke(new CacheSerializableRunnable("Populate region") {
@Override
public void run2() throws CacheException {
Region<Object, Object> region = createRegion(name);
region.put(key, value);
}
});
SerializableRunnable get = new CacheSerializableRunnable("Distributed get") {
@Override
public void run2() throws CacheException {
Region<Object, Object> region = createRegion(name);
assertThat(region.get(key)).isEqualTo(value);
}
};
vm1.invoke(get);
}
代码示例来源:origin: apache/geode
@Override
public void run() {
Region<String, String> rgn = getRootRegion().getSubregion(rgnName);
if (!rgn.getAttributes().getScope().isAck()) {
await().untilAsserted(() -> {
checkCommitAndNoData(rgn);
});
} else {
checkCommitAndNoData(rgn);
}
}
代码示例来源:origin: apache/geode
public RegionInformation(Region<?, ?> region, boolean recursive) {
this.name = region.getFullPath().substring(1);
this.path = region.getFullPath().substring(1);
this.scope = region.getAttributes().getScope();
this.dataPolicy = region.getAttributes().getDataPolicy();
if (region.getParentRegion() == null) {
this.isRoot = true;
if (recursive) {
Set<Region<?, ?>> subRegions = region.subregions(recursive);
subRegionInformationSet = getSubRegions(subRegions);
}
} else {
this.isRoot = false;
this.parentRegion = region.getParentRegion().getFullPath();
}
}
代码示例来源:origin: apache/geode
@Test
public void processReturnsCacheRegions() throws Exception {
RegionAttributes regionAttributesStub = mock(RegionAttributes.class);
when(cacheStub.getRegion(TEST_REGION1)).thenReturn(region1Stub);
when(region1Stub.getName()).thenReturn(TEST_REGION1);
when(region1Stub.size()).thenReturn(10);
when(region1Stub.getAttributes()).thenReturn(regionAttributesStub);
when(regionAttributesStub.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE);
when(regionAttributesStub.getKeyConstraint()).thenReturn(String.class);
when(regionAttributesStub.getValueConstraint()).thenReturn(Integer.class);
when(regionAttributesStub.getScope()).thenReturn(Scope.DISTRIBUTED_ACK);
Result result = operationHandler.process(serializationService,
MessageUtil.makeGetSizeRequest(TEST_REGION1), getNoAuthCacheExecutionContext(cacheStub));
RegionAPI.GetSizeResponse response = (RegionAPI.GetSizeResponse) result.getMessage();
Assert.assertEquals(10, response.getSize());
}
代码示例来源:origin: apache/geode
assertThat(getRegionAttributes().getScope().isDistributed()).isTrue();
代码示例来源:origin: apache/geode
assertThat(getRegionAttributes().getScope().isDistributed()).isTrue();
代码示例来源:origin: apache/geode
when(regionAttributes.getLoadFactor()).thenReturn(0.75f);
when(regionAttributes.getMembershipAttributes()).thenReturn(membershipAttributes);
when(regionAttributes.getScope()).thenReturn(scope);
when(partitionedRegion.getFullPath()).thenReturn("parent");
when(internalRegionArgs.getPartitionedRegion()).thenReturn(partitionedRegion);
代码示例来源:origin: apache/geode
void initialize(LocalRegion theRegion, Object theKey, Object theCallbackArg) {
this.region = theRegion;
this.regionName = theRegion.getFullPath();
this.key = theKey;
this.aCallbackArgument = theCallbackArg;
RegionAttributes attrs = theRegion.getAttributes();
Scope scope = attrs.getScope();
if (scope.isDistributed()) {
this.advisor = ((CacheDistributionAdvisee) this.region).getCacheDistributionAdvisor();
this.distributionManager = theRegion.getDistributionManager();
this.timeout = getSearchTimeout();
this.advisor.addMembershipListener(this);
}
}
代码示例来源:origin: apache/geode
public BucketRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
InternalCache cache, InternalRegionArguments internalRegionArgs) {
super(regionName, attrs, parentRegion, cache, internalRegionArgs);
if (PartitionedRegion.DISABLE_SECONDARY_BUCKET_ACK) {
Assert.assertTrue(attrs.getScope().isDistributedNoAck());
} else {
Assert.assertTrue(attrs.getScope().isDistributedAck());
}
Assert.assertTrue(attrs.getDataPolicy().withReplication());
Assert.assertTrue(!attrs.getEarlyAck());
Assert.assertTrue(isUsedForPartitionedRegionBucket());
Assert.assertTrue(!isUsedForPartitionedRegionAdmin());
Assert.assertTrue(internalRegionArgs.getBucketAdvisor() != null);
Assert.assertTrue(internalRegionArgs.getPartitionedRegion() != null);
this.redundancy = internalRegionArgs.getPartitionedRegionBucketRedundancy();
this.partitionedRegion = internalRegionArgs.getPartitionedRegion();
setEventSeqNum();
}
代码示例来源:origin: apache/geode
/**
* pause local operations so that a clear() can be performed and flush comm channels to the given
* member
*/
void lockLocallyForClear(DistributionManager dm, InternalDistributedMember locker,
CacheEvent event) {
RegionVersionVector rvv = getVersionVector();
ARMLockTestHook armLockTestHook = getRegionMap().getARMLockTestHook();
if (armLockTestHook != null) {
armLockTestHook.beforeLock(this, event);
}
if (rvv != null) {
// block new operations from being applied to the region map
rvv.lockForClear(getFullPath(), dm, locker);
// Check for region destroyed after we have locked, to make sure
// we don't continue a clear if the region has been destroyed.
checkReadiness();
// Only need to flush if NOACK at this point
if (this.getAttributes().getScope().isDistributedNoAck()) {
Set<InternalDistributedMember> members = getDistributionAdvisor().adviseCacheOp();
StateFlushOperation.flushTo(members, this);
}
}
if (armLockTestHook != null) {
armLockTestHook.afterLock(this, null);
}
}
代码示例来源:origin: apache/geode
this.requestInProgress = true;
RegionAttributes attrs = region.getAttributes();
Scope scope = attrs.getScope();
CacheLoader loader = ((AbstractRegion) region).basicGetLoader();
if (scope.isLocal()) {
内容来源于网络,如有侵权,请联系作者删除!