Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.DiskStoreFactory


  @Override
  public void afterPropertiesSet() throws Exception {
    Assert.state(cache != null, String.format("A reference to the GemFire Cache must be set for Disk Store '%1$s'.",
      getName()));

    DiskStoreFactory diskStoreFactory = cache.createDiskStoreFactory();

    if (allowForceCompaction != null) {
      diskStoreFactory.setAllowForceCompaction(allowForceCompaction);
    }
    if (autoCompact != null) {
      diskStoreFactory.setAutoCompact(autoCompact);
    }
    if (compactionThreshold != null) {
      diskStoreFactory.setCompactionThreshold(compactionThreshold);
    }
    if (diskUsageCriticalPercentage != null) {
      diskStoreFactory.setDiskUsageCriticalPercentage(diskUsageCriticalPercentage);
    }
    if (diskUsageWarningPercentage != null) {
      diskStoreFactory.setDiskUsageWarningPercentage(diskUsageWarningPercentage);
    }
    if (maxOplogSize != null) {
      diskStoreFactory.setMaxOplogSize(maxOplogSize);
    }
    if (queueSize != null) {
      diskStoreFactory.setQueueSize(queueSize);
    }
    if (timeInterval != null) {
      diskStoreFactory.setTimeInterval(timeInterval);
    }
    if (writeBufferSize != null) {
      diskStoreFactory.setWriteBufferSize(writeBufferSize);
    }

    if (!CollectionUtils.isEmpty(diskDirs)) {
      File[] diskDirFiles = new File[diskDirs.size()];
      int[] diskDirSizes = new int[diskDirs.size()];

      for (int index = 0; index < diskDirs.size(); index++) {
        DiskDir diskDir = diskDirs.get(index);
        diskDirFiles[index] = new File(diskDir.location);
        diskDirSizes[index] = (diskDir.maxSize != null ? diskDir.maxSize
          : DiskStoreFactory.DEFAULT_DISK_DIR_SIZE);
      }

      diskStoreFactory.setDiskDirsAndSizes(diskDirFiles, diskDirSizes);
    }

    diskStore = diskStoreFactory.create(getName());

    Assert.notNull(diskStore, String.format("DiskStore with name '%1$s' failed to be created successfully.",
      diskStore.getName()));
  }
View Full Code Here

TOP

Related Classes of com.gemstone.gemfire.cache.DiskStoreFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.