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

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

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

RegionAttributes.getCacheLoader介绍

[英]Returns the cache loader associated with this region.
[中]返回与此区域关联的缓存加载程序。

代码示例

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

@Override
public String getCacheLoader() {
 Object o = this.ra.getCacheLoader();
 if (o == null) {
  return "";
 } else {
  return o.toString();
 }
}

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

@Test
public void executeFunctionGivenARegionWithNonJdbcLoaderDoesNotRemoveTheLoader() {
 when(regionAttributes.getCacheLoader()).thenReturn(mock(CacheLoader.class));
 when(service.getMappingForRegion(eq(regionName))).thenReturn(mapping);
 function.executeFunction(context);
 verify(regionMutator, never()).setCacheLoader(null);
}

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

@Test
public void executeFunctionGivenARegionWithJdbcLoaderRemovesTheLoader() {
 when(regionAttributes.getCacheLoader()).thenReturn(mock(JdbcLoader.class));
 when(service.getMappingForRegion(eq(regionName))).thenReturn(mapping);
 function.executeFunction(context);
 verify(regionMutator, times(1)).setCacheLoader(null);
}

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

/**
 * Creates PartitionedRegionDataStore for dataStorage of PR and starts a PartitionService to
 * handle remote operations on this DataStore from other participating nodes.
 *
 * @param pr PartitionedRegion associated with this DataStore.
 */
PartitionedRegionDataStore(final PartitionedRegion pr) {
 final int bucketCount = pr.getTotalNumberOfBuckets();
 this.localBucket2RegionMap = new ConcurrentHashMap<Integer, BucketRegion>(bucketCount);
 this.partitionedRegion = pr;
 this.bucketCreationLock = new StoppableReentrantReadWriteLock(pr.getCancelCriterion());
 if (pr.getAttributes().getCacheLoader() != null) {
  this.loader = pr.getAttributes().getCacheLoader();
  if (logger.isDebugEnabled()) {
   logger.debug("Installing cache loader from partitioned region attributes: {}", loader);
  }
 }
 // this.maximumLocalBytes = (long) (pr.getLocalMaxMemory() *
 // PartitionedRegionHelper.BYTES_PER_MB
 // * this.partitionedRegion.rebalanceThreshold);
 this.maximumLocalBytes = (pr.getLocalMaxMemory() * PartitionedRegionHelper.BYTES_PER_MB);
 // this.bucketStats = new CachePerfStats(pr.getSystem(), "partition-" + pr.getName());
 this.bucketStats =
   new RegionPerfStats(pr.getCache(), pr.getCachePerfStats(), "partition-" + pr.getName());
 this.keysOfInterest = new ConcurrentHashMap();
}

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

continue;
} else {
 if (n.isCacheLoaderAttached() && pr.getAttributes().getCacheLoader() == null) {
  throw new IllegalStateException(
    String.format(
      new Object[] {this.pr.getName()}));
 if (!n.isCacheLoaderAttached() && pr.getAttributes().getCacheLoader() != null) {
  throw new IllegalStateException(
    String.format(

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

CacheLoader loader = ra.getCacheLoader();
if (loader != null) {
 allCacheLoaders.add(loader);

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

"poolName is not the same: " + this.poolName + " != " + other.getPoolName());
if (!equal(this.cacheLoader, other.getCacheLoader())) {
 throw new RuntimeException("CacheLoader are not the same");

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

public static RegionAttributesData getRegionAttributesData(RegionAttributes<?, ?> regAttrs) {
 if (regAttrs.getCacheLoader() != null) {
  cacheLoaderClassName = regAttrs.getCacheLoader().getClass().getCanonicalName();

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

CacheLoader<?, ?> cacheLoader = ra.getCacheLoader();

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

private void cleanupRegionAndQueue(Cache cache, String regionName) {
  String queueName = CreateMappingCommand.createAsyncEventQueueName(regionName);

  Region<?, ?> region = cache.getRegion(regionName);
  if (region != null) {
   CacheLoader<?, ?> loader = region.getAttributes().getCacheLoader();
   if (loader instanceof JdbcLoader) {
    region.getAttributesMutator().setCacheLoader(null);
   }
   CacheWriter<?, ?> writer = region.getAttributes().getCacheWriter();
   if (writer instanceof JdbcWriter) {
    region.getAttributesMutator().setCacheWriter(null);
   }
   Set<String> queueIds = region.getAttributes().getAsyncEventQueueIds();
   if (queueIds.contains(queueName)) {
    region.getAttributesMutator().removeAsyncEventQueueId(queueName);
   }
  }

  InternalAsyncEventQueue queue = (InternalAsyncEventQueue) cache.getAsyncEventQueue(queueName);
  if (queue != null) {
   queue.stop();
   queue.destroy();
  }
 }
}

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

generate(CACHE_LOADER, attrs.getCacheLoader());

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

byte loaderByte = (byte) (getAttributes().getCacheLoader() != null ? 0x01 : 0x00);
byte writerByte = (byte) (getAttributes().getCacheWriter() != null ? 0x02 : 0x00);
this.node.setLoaderWriterByte((byte) (loaderByte + writerByte));

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

DistributionConfig.GEMFIRE_PREFIX + "mimimumPartitionedRegionReadRedundancy", 0);
this.haveCacheLoader = regionAttributes.getCacheLoader() != null;

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

this.gatewaySenderIds = new HashSet<String>(attrs.getGatewaySenderIds());
this.asyncEventQueueIds = new HashSet<String>(attrs.getAsyncEventQueueIds());
this.cacheLoader = attrs.getCacheLoader();
this.cacheWriter = attrs.getCacheWriter();
this.entryIdleTimeout = attrs.getEntryIdleTimeout();

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

assignCacheLoader(attrs.getCacheLoader());
assignCacheWriter(attrs.getCacheWriter());
this.regionTimeToLive = attrs.getRegionTimeToLive().getTimeout();

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

new ArrayList<>(Arrays.asList(regionAttributes.getCacheListeners()));
this.regionAttributes.cacheLoader = regionAttributes.getCacheLoader();
this.regionAttributes.cacheWriter = regionAttributes.getCacheWriter();
this.regionAttributes.regionTimeToLive = regionAttributes.getRegionTimeToLive().getTimeout();

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

this.cacheLoaderDesc = getDesc(attr.getCacheLoader());
this.cacheWriterDesc = getDesc(attr.getCacheWriter());
this.cacheListenerDescs = getDescs(attr.getCacheListeners());

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

AttributesFactory factory = new AttributesFactory();
RegionAttributes attrs = factory.create();
assertNull(attrs.getCacheLoader());
assertNull(attrs.getCacheWriter());
assertNull(attrs.getCacheListener());

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

if (parentIsUserSpecified) {
 if (parentWithHas.hasCacheLoader()) {
  setCacheLoader(parent.getCacheLoader());
 setCacheLoader(parent.getCacheLoader());

代码示例来源:origin: org.springframework.data/spring-data-geode-test

.orElse(EvictionAttributes.DEFAULT_ENTRIES_MAXIMUM));
AtomicReference<CacheLoader<K, V>> cacheLoader = new AtomicReference<>(baseRegionAttributes.getCacheLoader());
  .when(mockAttributesMutator).removeGatewaySenderId(anyString());
doAnswer(newSetter(cacheLoader, baseRegionAttributes.getCacheLoader()))
  .when(mockAttributesMutator).setCacheLoader(any(CacheLoader.class));
  .thenAnswer(invocation -> cacheListeners.toArray(new CacheListener[cacheListeners.size()]));
when(mockRegionAttributes.getCacheLoader()).thenAnswer(newGetter(cacheLoader::get));
when(mockRegionAttributes.getCacheWriter()).thenAnswer(newGetter(cacheWriter::get));
when(mockRegionAttributes.getCloningEnabled()).thenAnswer(newGetter(cloningEnabled::get));

相关文章

微信公众号

最新文章

更多

RegionAttributes类方法