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


Java Cache.createDiskStoreFactory方法代码示例

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


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

示例1: createPersistentRegionAsync

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
/**
 * Creates a persistent region in async manner
 * 
 * @param vm
 *          reference to VM
 * @return reference to AsyncInvocation
 */
@SuppressWarnings("serial")
protected AsyncInvocation createPersistentRegionAsync(final VM vm) {
  SerializableRunnable createRegion = new SerializableRunnable(
      "Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      File dir = getDiskDirForVM(vm);
      dir.mkdirs();
      dsf.setDiskDirs(new File[] { dir });
      dsf.setMaxOplogSize(1);
      dsf.setAllowForceCompaction(true);
      dsf.setAutoCompact(false);
      DiskStore ds = dsf.create(REGION_NAME);
      RegionFactory rf = cache.createRegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(true);
      rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
      rf.setScope(Scope.DISTRIBUTED_ACK);
      rf.create(REGION_NAME);
    }
  };
  return vm.invokeAsync(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:DiskManagementDUnitTest.java

示例2: createPersistentRegionWithoutCompaction

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected SerializableRunnable createPersistentRegionWithoutCompaction(final VM vm0) {
  SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      File dir = getDiskDirForVM(vm0);
      dir.mkdirs();
      dsf.setDiskDirs(new File[] {dir});
      dsf.setMaxOplogSize(1);
      dsf.setAutoCompact(false);
      dsf.setAllowForceCompaction(true);
      dsf.setCompactionThreshold(20);
      DiskStore ds = dsf.create(REGION_NAME);
      RegionFactory rf = new RegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(true);
      rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
      rf.setScope(Scope.DISTRIBUTED_ACK);
      rf.create(REGION_NAME);
    }
  };
  vm0.invoke(createRegion);
  return createRegion;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:25,代码来源:PersistentReplicatedTestBase.java

示例3: createPersistentRegionAsync

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected AsyncInvocation createPersistentRegionAsync(final VM vm) {
  SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      File dir = getDiskDirForVM(vm);
      dir.mkdirs();
      dsf.setDiskDirs(new File[] {dir});
      dsf.setMaxOplogSize(1);
      DiskStore ds = dsf.create(REGION_NAME);
      RegionFactory rf = new RegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(true);
      rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
      rf.setScope(Scope.DISTRIBUTED_ACK);
      rf.create(REGION_NAME);
    }
  };
  return vm.invokeAsync(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:PersistentReplicatedTestBase.java

示例4: createPersistentRegionAsync

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected AsyncInvocation createPersistentRegionAsync(final VM vm, final boolean diskSynchronous) {
  SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      File dir = getDiskDirForVM(vm);
      dir.mkdirs();
      dsf.setDiskDirs(new File[] {dir});
      dsf.setMaxOplogSize(1);
      DiskStore ds = dsf.create(REGION_NAME);
      RegionFactory rf = new RegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(diskSynchronous);
      rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
      rf.setScope(Scope.DISTRIBUTED_ACK);
      rf.create(REGION_NAME);
    }
  };
  return vm.invokeAsync(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:PersistentRecoveryOrderDUnitTest.java

示例5: createRegion

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private LocalRegion createRegion(final VM vm0) {
  Cache cache = getCache();
  DiskStoreFactory dsf = cache.createDiskStoreFactory();
  File dir = getDiskDirForVM(vm0);
  dir.mkdirs();
  dsf.setDiskDirs(new File[] {dir});
  dsf.setMaxOplogSize(1);
  //Turn of automatic compaction
  dsf.setAllowForceCompaction(true);
  dsf.setAutoCompact(false);
  //The compaction javadocs seem to be wrong. This
  //is the amount of live data in the oplog
  dsf.setCompactionThreshold(40);
  DiskStore ds = dsf.create(REGION_NAME);
  RegionFactory rf = new RegionFactory();
  rf.setDiskStoreName(ds.getName());
  rf.setDiskSynchronous(true);
  rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
  rf.setScope(Scope.DISTRIBUTED_ACK);
  LocalRegion region = (LocalRegion) rf.create(REGION_NAME);
  return region;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:23,代码来源:PersistentRVVRecoveryDUnitTest.java

示例6: createAsyncRegionWithSmallQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private Region createAsyncRegionWithSmallQueue(final VM vm0) {
  Cache cache = getCache();
  DiskStoreFactoryImpl dsf = (DiskStoreFactoryImpl) cache.createDiskStoreFactory();
  File dir = getDiskDirForVM(vm0);
  dir.mkdirs();
  dsf.setDiskDirs(new File[] {dir});
  dsf.setMaxOplogSizeInBytes(500);
  dsf.setQueueSize(1000);
  dsf.setTimeInterval(1000);
  DiskStore ds = dsf.create(REGION_NAME);
  RegionFactory rf = new RegionFactory();
  rf.setDiskStoreName(ds.getName());
  rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
  rf.setScope(Scope.DISTRIBUTED_ACK);
  rf.setDiskSynchronous(false);
  Region region = rf.create(REGION_NAME);
  return region;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:19,代码来源:PersistentRVVRecoveryDUnitTest.java

示例7: initQueue

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private SingleWriteSingleReadRegionQueue initQueue(boolean conflate) {
    Cache cache = getCache();
    GatewayQueueAttributes queueAttrs = new GatewayQueueAttributes();
    queueAttrs.setBatchConflation(true);
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    File overflowDir = new File(getUniqueName() + InternalDistributedSystem.getAnyInstance().getId());
    if (!overflowDir.exists()) {
      overflowDir.mkdir();
    }
    assertTrue(overflowDir.isDirectory());
    File[] dirs1 = new File[] {overflowDir.getAbsoluteFile()};
    dsf.setDiskDirs(dirs1).create(getUniqueName());
    queueAttrs.setDiskStoreName(getUniqueName());
//    queueAttrs.setOverflowDirectory(getUniqueName() + InternalDistributedSystem.getAnyInstance().getId());
    CacheListener listener = new CacheListenerAdapter() {
      
    };
    GatewayStats stats = new GatewayStats(cache.getDistributedSystem(), "g1", "h1", null);
    SingleWriteSingleReadRegionQueue queue = new SingleWriteSingleReadRegionQueue(cache, "region", queueAttrs, listener, stats);
    return queue;
  }
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:SingleWriteSingleReadRegionQueueDUnitTest.java

示例8: createOverflowRegion

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected void createOverflowRegion(final VM vm) {
  SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      dsf.setDiskDirs(getDiskDirs(getUniqueName()));
      dsf.setMaxOplogSize(1);
      DiskStore ds = dsf.create(getUniqueName());
      
      
      RegionFactory rf = new RegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(true);
      rf.setDataPolicy(DataPolicy.REPLICATE);
      rf.setEvictionAttributes(EvictionAttributes.createLIFOEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK));
      rf.create("region3");
    }
  };
  vm.invoke(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:BackupDUnitTest.java

示例9: createForOffline

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private static DiskStoreImpl createForOffline(String dsName, File[] dsDirs,
    boolean offlineCompacting, boolean offlineValidate,
    boolean upgradeVersionOnly, long maxOplogSize, boolean needsOplogs)
        throws Exception {
  if (dsDirs == null) {
    dsDirs = new File[] { new File("") };
  }
  // need a cache so create a loner ds
  Properties props = new Properties();
  props.setProperty("locators", "");
  props.setProperty("mcast-port", "0");
  props.setProperty("cache-xml-file", "");
  if (!TRACE_RECOVERY) {
    props.setProperty("log-level", "warning");
  }
  DistributedSystem ds = GemFireCacheImpl.getInstance().getDistributedSystem();

  offlineDS = ds;
  Cache c = GemFireCacheImpl.getInstance();
  offlineCache = c;
  com.gemstone.gemfire.cache.DiskStoreFactory dsf = c
      .createDiskStoreFactory();
  dsf.setDiskDirs(dsDirs);
  if (offlineCompacting && maxOplogSize != -1L) {
    dsf.setMaxOplogSize(maxOplogSize);
  }
  DiskStoreImpl dsi = new GFXDDiskStoreImpl(c, dsName,
      ((DiskStoreFactoryImpl) dsf).getDiskStoreAttributes(), false, null,
      true, upgradeVersionOnly, offlineValidate, offlineCompacting,
      needsOplogs);
  ((GemFireCacheImpl) c).addDiskStore(dsi);
  return dsi;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:34,代码来源:GFXDDiskStoreImpl.java

示例10: createForOffline

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private static DiskStoreImpl createForOffline(String dsName, File[] dsDirs,
    boolean offlineCompacting, boolean offlineValidate,
    boolean upgradeVersionOnly, long maxOplogSize, boolean needsOplogs)
    throws Exception {
  if (dsDirs == null) {
    dsDirs = new File[] { new File("") };
  }
  // need a cache so create a loner ds
  Properties props = new Properties();
  props.setProperty("locators", "");
  props.setProperty("mcast-port", "0");
  props.setProperty("cache-xml-file", "");
  if (!TRACE_RECOVERY) {
    props.setProperty("log-level", "warning");
  }
  DistributedSystem ds = DistributedSystem.connect(props);
  offlineDS = ds;
  Cache c = com.gemstone.gemfire.cache.CacheFactory.create(ds);
  offlineCache = c;
  com.gemstone.gemfire.cache.DiskStoreFactory dsf = c
      .createDiskStoreFactory();
  dsf.setDiskDirs(dsDirs);
  if (offlineCompacting && maxOplogSize != -1L) {
    dsf.setMaxOplogSize(maxOplogSize);
  }
  DiskStoreImpl dsi = new DiskStoreImpl(c, dsName,
      ((DiskStoreFactoryImpl) dsf).getDiskStoreAttributes(), false, null,
      true, upgradeVersionOnly, offlineValidate, offlineCompacting,
      needsOplogs);
  ((GemFireCacheImpl) c).addDiskStore(dsi);
  return dsi;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:33,代码来源:DiskStoreImpl.java

示例11: createParRegWithPersistence

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private Region<?,?> createParRegWithPersistence(String regionName, String diskStoreName, String diskDirName) {
  Cache cache = getCache();
  File diskStoreDirFile = new File(diskDirName);
  diskStoreDirFile.deleteOnExit();
  
  if (!diskStoreDirFile.exists()) {
    diskStoreDirFile.mkdirs();
  }
  
  DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
  diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile });
  diskStoreFactory.setMaxOplogSize(1);
  diskStoreFactory.setAllowForceCompaction(true);
  diskStoreFactory.setAutoCompact(false);
  diskStoreFactory.create(diskStoreName);
  
  /****
   * Eviction Attributes
   */
  EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK);
  
  RegionFactory regionFactory = cache.createRegionFactory();
  regionFactory.setDiskStoreName(diskStoreName);
  regionFactory.setDiskSynchronous(true);
  regionFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
  regionFactory.setEvictionAttributes(ea);
  
  return regionFactory.create(regionName);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:30,代码来源:IndexCommandsDUnitTest.java

示例12: createRepRegWithPersistence

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private Region<?,?> createRepRegWithPersistence(String regionName, String diskStoreName, String diskDirName) {
  Cache cache = getCache();
  File diskStoreDirFile = new File(diskDirName);
  diskStoreDirFile.deleteOnExit();
  
  if (!diskStoreDirFile.exists()) {
    diskStoreDirFile.mkdirs();
  }
  
  DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
  diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile });
  diskStoreFactory.setMaxOplogSize(1);
  diskStoreFactory.setAllowForceCompaction(true);
  diskStoreFactory.setAutoCompact(false);
  diskStoreFactory.create(diskStoreName);
  
  /****
   * Eviction Attributes
   */
  EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK);
  
  RegionFactory regionFactory = cache.createRegionFactory();
  regionFactory.setDiskStoreName(diskStoreName);
  regionFactory.setDiskSynchronous(true);
  regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
  regionFactory.setEvictionAttributes(ea);
  
  return regionFactory.create(regionName);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:30,代码来源:IndexCommandsDUnitTest.java

示例13: createParRegWithPersistence

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
private Region<?,?> createParRegWithPersistence(String regionName, String diskStoreName, String diskDirName) {
  Cache cache = getCache();
  File diskStoreDirFile = new File(diskDirName);
  
  if (!diskStoreDirFile.exists()) {
    diskStoreDirFile.mkdirs();
  }
  
  DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();
  diskStoreFactory.setDiskDirs(new File[] { diskStoreDirFile });
  diskStoreFactory.setMaxOplogSize(1);
  diskStoreFactory.setAllowForceCompaction(true);
  diskStoreFactory.setAutoCompact(false);
  diskStoreFactory.create(diskStoreName);
  
  /****
   * Eviction Attributes
   */
  EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1, EvictionAction.OVERFLOW_TO_DISK);
  
  RegionFactory regionFactory = cache.createRegionFactory();
  regionFactory.setDiskStoreName(diskStoreName);
  regionFactory.setDiskSynchronous(true);
  regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
  regionFactory.setScope(Scope.DISTRIBUTED_ACK);
  regionFactory.setEvictionAttributes(ea);
  
  return regionFactory.create(regionName);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:30,代码来源:DiskStoreCommandsDUnitTest.java

示例14: createPersistentGatewayAsync

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected AsyncInvocation createPersistentGatewayAsync(final VM vm, final int destinationPort) {
  SerializableRunnable createRegion = new SerializableRunnable("Create gateway region") {
    public void run() {
      Cache cache = getCache();
      RegionFactory rf = new RegionFactory();
      rf.setDataPolicy(DataPolicy.REPLICATE);
      rf.setScope(Scope.DISTRIBUTED_ACK);
      rf.setEnableGateway(true);
      rf.create(REGION_NAME);
      int port = AvailablePortHelper.getRandomAvailableTCPPort();
      GatewayHub hub = cache.addGatewayHub("h1", port);
      Gateway gateway = hub.addGateway("g1");
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      dsf.setDiskDirs(getDiskDirs());
      dsf.setMaxOplogSize(1);
      DiskStore ds = dsf.create(REGION_NAME);
      gateway.setQueueAttributes(new GatewayQueueAttributes(ds.getName(), 5, 1, 100, false, true, 60000));
      try {
        gateway.addEndpoint("end1", InetAddress.getLocalHost().getHostAddress(), destinationPort);
        hub.start();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  };
  return vm.invokeAsync(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:28,代码来源:PersistentGatewayDUnitTest.java

示例15: createPersistentRegionAsync

import com.gemstone.gemfire.cache.Cache; //导入方法依赖的package包/类
protected AsyncInvocation createPersistentRegionAsync(final VM vm) {
  SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
    public void run() {
      Cache cache = getCache();
      DiskStoreFactory dsf = cache.createDiskStoreFactory();
      dsf.setDiskDirs(getDiskDirs(getUniqueName()));
      dsf.setMaxOplogSize(1);
      DiskStore ds = dsf.create(getUniqueName());
      
      
      RegionFactory rf = new RegionFactory();
      rf.setDiskStoreName(ds.getName());
      rf.setDiskSynchronous(true);
      rf.setDataPolicy(getDataPolicy());
      PartitionAttributesFactory paf = new PartitionAttributesFactory();
      paf.setRedundantCopies(0);
      rf.setPartitionAttributes(paf.create());
      rf.create("region1");
      
      dsf = cache.createDiskStoreFactory();
      dsf.setDiskDirs(getDiskDirs(getUniqueName()+2));
      dsf.setMaxOplogSize(1);
      ds = dsf.create(getUniqueName()+2);
      rf.setDiskStoreName(getUniqueName()+2);
      rf.create("region2");
    }
  };
  return vm.invokeAsync(createRegion);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:30,代码来源:BackupDUnitTest.java


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