org.apache.geode.cache.RegionAttributes.getDataPolicy()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.apache.geode.cache.RegionAttributes.getDataPolicy方法的一些代码示例,展示了RegionAttributes.getDataPolicy的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RegionAttributes.getDataPolicy方法的具体详情如下:
包路径:org.apache.geode.cache.RegionAttributes
类名称:RegionAttributes
方法名:getDataPolicy

RegionAttributes.getDataPolicy介绍

[英]Returns the data policy for this region. Default value of DataPolicy is set to 'Normal'. Please refer the gemfire documentation for more details on this.
[中]返回此区域的数据策略。DataPolicy的默认值设置为“正常”。有关这方面的更多细节,请参阅gemfire文档。

代码示例

代码示例来源:origin: apache/geode

@Override
public DataPolicy getDataPolicy() {
 return this.ra.getDataPolicy();
}

代码示例来源:origin: apache/geode

public DataPolicy getDataPolicy() {
 if (this.event != null) {
  return this.event.getRegion().getAttributes().getDataPolicy();
 }
 return null;
}

代码示例来源:origin: apache/geode

protected boolean withPersistence() {
 RegionAttributes ra = dataRegion.getAttributes();
 DataPolicy dp = ra.getDataPolicy();
 final boolean withPersistence = dp.withPersistence();
 return withPersistence;
}

代码示例来源:origin: apache/geode

@Override
 public <K, V> Set<Integer> getLocalBucketSet(Region<K, V> region) {
  if (!region.getAttributes().getDataPolicy().withPartitioning()) {
   return null;
  }
  return this.localBucketSet;
 }
}

代码示例来源:origin: apache/geode

@Override
public Set<Region<?, ?>> rootRegions() {
 preOp();
 Set<Region<?, ?>> rootRegions = new HashSet<>();
 for (Region<?, ?> region : this.cache.rootRegions()) {
  if (!region.getAttributes().getDataPolicy().withStorage()) {
   rootRegions.add(new ProxyRegion(this, region));
  }
 }
 return Collections.unmodifiableSet(rootRegions);
}

代码示例来源:origin: apache/geode

/**
 * Returns true if this region's config indicates that it will use a disk store. Added for bug
 * 42055.
 */
protected boolean usesDiskStore(RegionAttributes regionAttributes) {
 return !isProxy() && (getAttributes().getDataPolicy().withPersistence() || isOverflowEnabled());
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsPersistentPartition() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_PARTITION);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isTrue();
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsPersistentReplicate() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isTrue();
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsPartition() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isFalse();
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsPreloaded() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.PRELOADED);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isFalse();
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsReplicate() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.REPLICATE);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isFalse();
}

代码示例来源:origin: apache/geode

@Test
public void executeCreatesSerialAsyncQueueForNonPartitionedRegion() throws Exception {
 when(attributes.getDataPolicy()).thenReturn(DataPolicy.REPLICATE);
 function.executeFunction(context);
 verify(asyncEventQueueFactory, times(1)).create(any(), any());
 verify(asyncEventQueueFactory, times(1)).setParallel(false);
}

代码示例来源:origin: apache/geode

@Test
public void executeCreatesParallelAsyncQueueForPartitionedRegion() throws Exception {
 when(attributes.getDataPolicy()).thenReturn(DataPolicy.PARTITION);
 function.executeFunction(context);
 verify(asyncEventQueueFactory, times(1)).create(any(), any());
 verify(asyncEventQueueFactory, times(1)).setParallel(true);
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionPersistentWhenDataPolicyIsNormal() {
 final Region mockRegion = mock(Region.class, "Region");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.NORMAL);
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isPersistent(mockRegion)).isFalse();
}

代码示例来源:origin: apache/geode

@Test
public void testIsRegionUsingDiskStoreWhenDiskStoresMismatch() {
 final Region mockRegion = mock(Region.class, "Region");
 final DiskStore mockDiskStore = mock(DiskStore.class, "DiskStore");
 final RegionAttributes mockRegionAttributes = mock(RegionAttributes.class, "RegionAttributes");
 when(mockRegion.getAttributes()).thenReturn(mockRegionAttributes);
 when(mockRegionAttributes.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_PARTITION);
 when(mockRegionAttributes.getDiskStoreName()).thenReturn("mockDiskStore");
 when(mockDiskStore.getName()).thenReturn("testDiskStore");
 final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction();
 assertThat(function.isUsingDiskStore(mockRegion, mockDiskStore)).isFalse();
}

代码示例来源: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

@Override
 public void createOn(Connection conn, boolean isDurable) {
  byte regionDataPolicyOrdinal = getCqBaseRegion() == null ? (byte) 0
    : getCqBaseRegion().getAttributes().getDataPolicy().ordinal;

  int state = this.cqState.getState();
  this.cqProxy.createOn(getName(), conn, getQueryString(), state, isDurable,
    regionDataPolicyOrdinal);
 }
}

代码示例来源:origin: apache/geode

protected static boolean isLocalAccessor(CacheDistributionAdvisee region) {
 if (!region.getAttributes().getDataPolicy().withStorage()) {
  return true;
 }
 if (region.getAttributes().getPartitionAttributes() != null
   && region.getAttributes().getPartitionAttributes().getLocalMaxMemory() == 0) {
  return true;
 }
 return false;
}

代码示例来源:origin: apache/geode

/**
 * Create a continuous query on the given server and return the initial query results.
 *
 * @param cq the CQ to create on the server
 */
public SelectResults createWithIR(ClientCQ cq) {
 pool.getRITracker().addCq(cq, cq.isDurable());
 byte regionDataPolicyOrdinal = cq.getCqBaseRegion() == null ? (byte) 0
   : cq.getCqBaseRegion().getAttributes().getDataPolicy().ordinal;
 return CreateCQWithIROp.execute(this.pool, cq.getName(), cq.getQueryString(),
   CqStateImpl.RUNNING, cq.isDurable(), regionDataPolicyOrdinal);
}

代码示例来源:origin: apache/geode

/**
 * Create a continuous query on the given pool
 *
 * @param cq the CQ to create on the server
 */
public Object create(ClientCQ cq) {
 pool.getRITracker().addCq(cq, cq.isDurable());
 byte regionDataPolicyOrdinal = cq.getCqBaseRegion() == null ? (byte) 0
   : cq.getCqBaseRegion().getAttributes().getDataPolicy().ordinal;
 return CreateCQOp.execute(this.pool, cq.getName(), cq.getQueryString(), CqStateImpl.RUNNING,
   cq.isDurable(), regionDataPolicyOrdinal);
}

相关文章

微信公众号

最新文章

更多

RegionAttributes类方法