当前位置: 首页>>代码示例>>Java>>正文


Java Cache.getAsyncEventQueues方法代码示例

本文整理汇总了Java中com.gemstone.gemfire.cache.Cache.getAsyncEventQueues方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.getAsyncEventQueues方法的具体用法?Java Cache.getAsyncEventQueues怎么用?Java Cache.getAsyncEventQueues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.gemstone.gemfire.cache.Cache的用法示例。


在下文中一共展示了Cache.getAsyncEventQueues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExecutorToCheckForHubRunningAndIsPrimary

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
static Callable<?> getExecutorToCheckForHubRunningAndIsPrimary(
    final String id, final boolean shouldWBCLBeRunning) {

  SerializableCallable checkForHubRunningAndPrimary = new SerializableCallable(
      "Check Hub Running & is Primary") {
    public Object call() throws CacheException {

      try {
        boolean[] isHubRunningAndPrimary = new boolean[] { false, false };
        Cache cache = Misc.getGemFireCache();
        for (AsyncEventQueue asyncQueue : cache.getAsyncEventQueues()) {
          if (id.equals(asyncQueue.getId())) {
            isHubRunningAndPrimary[0] = asyncQueue.isRunning();
            isHubRunningAndPrimary[1] = asyncQueue.isPrimary();
            return isHubRunningAndPrimary;
          }
        }
        return isHubRunningAndPrimary;
      } catch (Exception e) {
        throw GemFireXDRuntimeException.newRuntimeException(null, e);
      }

    }
  };
  return checkForHubRunningAndPrimary;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:27,代码来源:DBSynchronizerTestBase.java

示例2: getAsyncEventQueues

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Returns the async event queues for the current cache, or null if no async
 * event queues or cache exists.
 */
public static Set<AsyncEventQueue> getAsyncEventQueues() {
  Cache cache = CacheHelper.getCache();
  if (cache == null) {
    return null;
  } else {
    Set<AsyncEventQueue> queues = cache.getAsyncEventQueues();
    return (queues == null || queues.size() == 0) ? null : queues;
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:AsyncEventQueueHelper.java

示例3: testAsyncEventQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public void testAsyncEventQueue() {
  getSystem();
  CacheCreation cache = new CacheCreation();
  
  String id = "WBCLChannel";
  AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
  factory.setBatchSize(100);
  factory.setBatchTimeInterval(500);
  factory.setBatchConflationEnabled(true);
  factory.setMaximumQueueMemory(200);
  factory.setPersistent(true);
  factory.setDiskStoreName("WBCLStore");
  factory.setDiskSynchronous(true);
  factory.setParallel(true);
  
  AsyncEventListener eventListener = new MyAsyncEventListener();
  AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
  
  RegionAttributesCreation attrs = new RegionAttributesCreation();
  attrs.addAsyncEventQueueId(asyncEventQueue.getId());
  cache.createRegion("UserRegion", attrs);
  
  testXml(cache);
  Cache c = getCache();
  assertNotNull(c);
  
  Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
  assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
  
  for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
    validateAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:34,代码来源:CacheXml70Test.java

示例4: testConcurrentAsyncEventQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
public void testConcurrentAsyncEventQueue() {
  getSystem();
  CacheCreation cache = new CacheCreation();
  
  String id = "WBCLChannel";
  AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
  factory.setBatchSize(100);
  factory.setBatchTimeInterval(500);
  factory.setBatchConflationEnabled(true);
  factory.setMaximumQueueMemory(200);
  factory.setPersistent(true);
  factory.setDiskStoreName("WBCLStore");
  factory.setDiskSynchronous(true);
  factory.setDispatcherThreads(5);
  factory.setOrderPolicy(OrderPolicy.THREAD);
  
  AsyncEventListener eventListener = new MyAsyncEventListener();
  AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
  
  RegionAttributesCreation attrs = new RegionAttributesCreation();
  attrs.addAsyncEventQueueId(asyncEventQueue.getId());
  cache.createRegion("UserRegion", attrs);
  
  testXml(cache);
  Cache c = getCache();
  assertNotNull(c);
  
  Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
  assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
  
  for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
    validateConcurrentAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:35,代码来源:CacheXml70Test.java

示例5: generateAsyncEventQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private void generateAsyncEventQueue(Cache cache) throws SAXException {
    Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
    for (AsyncEventQueue asyncEventQueue : asyncEventQueues) {
      AttributesImpl atts = new AttributesImpl();
      // id
      atts.addAttribute("", "", ID, "", asyncEventQueue.getId());
      // parallel
      if (generateDefaults() || asyncEventQueue.isParallel() != GatewaySender.DEFAULT_IS_PARALLEL)
      atts.addAttribute("", "", PARALLEL, "", String.valueOf(asyncEventQueue.isParallel()));
      // batch-size
      if (generateDefaults() || asyncEventQueue.getBatchSize() != GatewaySender.DEFAULT_BATCH_SIZE)
      atts.addAttribute("", "", BATCH_SIZE, "", String.valueOf(asyncEventQueue
        .getBatchSize()));
      // batch-time-interval
      if (generateDefaults() || asyncEventQueue.getBatchTimeInterval() != GatewaySender.DEFAULT_BATCH_TIME_INTERVAL)
      atts.addAttribute("", "", BATCH_TIME_INTERVAL, "", String.valueOf(asyncEventQueue
          .getBatchTimeInterval()));
      // enable-batch-conflation
      if (generateDefaults() || asyncEventQueue.isBatchConflationEnabled() != GatewaySender.DEFAULT_BATCH_CONFLATION)
      atts.addAttribute("", "", ENABLE_BATCH_CONFLATION, "", String.valueOf(asyncEventQueue
          .isBatchConflationEnabled()));
      // maximum-queue-memory
      if (generateDefaults() || asyncEventQueue.getMaximumQueueMemory() != GatewaySender.DEFAULT_MAXIMUM_QUEUE_MEMORY)
      atts.addAttribute("", "", MAXIMUM_QUEUE_MEMORY, "", String.valueOf(asyncEventQueue
        .getMaximumQueueMemory()));
      // enable-persistence
      if (generateDefaults() || asyncEventQueue.isPersistent() != GatewaySender.DEFAULT_PERSISTENCE_ENABLED)
      atts.addAttribute("", "", PERSISTENT, "", String.valueOf(asyncEventQueue
        .isPersistent()));
      if (asyncEventQueue.isPersistent()) {
        //disk-store-name
        if (generateDefaults() || (asyncEventQueue.getDiskStoreName() != null && !asyncEventQueue.getDiskStoreName().equals("")))
        atts.addAttribute("", "", DISK_STORE_NAME, "", String.valueOf(asyncEventQueue
            .getDiskStoreName()));
      }
      // dispatcher-threads
      if (generateDefaults() || asyncEventQueue.getDispatcherThreads() != GatewaySender.DEFAULT_DISPATCHER_THREADS)
      atts.addAttribute("", "", DISPATCHER_THREADS, "", String.valueOf(asyncEventQueue
          .getDispatcherThreads()));
      // order-policy
      if (asyncEventQueue.getOrderPolicy() != null) {
        if (generateDefaults() || !asyncEventQueue.getOrderPolicy().equals(GatewaySender.DEFAULT_ORDER_POLICY))
        atts.addAttribute("", "", ORDER_POLICY, "", String.valueOf(asyncEventQueue
          .getOrderPolicy()));
      }
      // disk-synchronous
      if (generateDefaults() || asyncEventQueue.isDiskSynchronous() != GatewaySender.DEFAULT_DISK_SYNCHRONOUS)
      atts.addAttribute("", "", DISK_SYNCHRONOUS, "", String.valueOf(asyncEventQueue
          .isDiskSynchronous()));
      handler.startElement("", ASYNC_EVENT_QUEUE, ASYNC_EVENT_QUEUE, atts);
    
      AsyncEventListener asyncListener = asyncEventQueue.getAsyncEventListener();
      if (asyncListener != null) {
        generate(ASYNC_EVENT_LISTENER, asyncListener);
      }
    
      handler.endElement("", ASYNC_EVENT_QUEUE, ASYNC_EVENT_QUEUE);
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:60,代码来源:CacheXmlGenerator.java


注:本文中的com.gemstone.gemfire.cache.Cache.getAsyncEventQueues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。