public BDBJEConfig(File dataRoot, long cacheSizeInBytes) { this.dataRoot = dataRoot; if (cacheSizeInBytes > 0L) { cacheSize = new DataAmount(cacheSizeInBytes); } }
long totalSize = config.offHeapBufferSize.getNumberOfBytes(); int totalSegments = (int)(totalSize + OFF_HEAP_BUFFER_SEGMENT_LEN - 1) / OFF_HEAP_BUFFER_SEGMENT_LEN; totalSegments = 10; int maxPerBuffer = (int) (config.maxPerEntryBuffering.getNumberOfBytes() + OFF_HEAP_BUFFER_SEGMENT_LEN - 1) / OFF_HEAP_BUFFER_SEGMENT_LEN; _maxSegmentsPerBuffer = Math.max(2, maxPerBuffer);
protected EnvironmentConfig envConfigForStore(boolean allowCreate, boolean writeAccess) { EnvironmentConfig config = new EnvironmentConfig(); config.setAllowCreate(allowCreate); config.setReadOnly(!writeAccess); config.setTransactional(_bdbConfig.useTransactions); config.setSharedCache(false); config.setCacheSize(_bdbConfig.cacheSize.getNumberOfBytes()); // Default of 500 msec way too low; usually set to higher value: config.setLockTimeout(_bdbConfig.lockTimeoutMsecs, TimeUnit.MILLISECONDS); // Default of 1 for lock count is not good; let's see what to use instead: config.setConfigParam(EnvironmentConfig.LOCK_N_LOCK_TABLES, String.valueOf(_bdbConfig.lockTableCount)); return config; }
public StoreConfig overrideOffHeapBufferSize(long sizeInBytes) { offHeapBufferSize = new DataAmount(sizeInBytes); return this; }
public StoreConfig overrideOffHeapBufferSize(String sizeDesc) { offHeapBufferSize = new DataAmount(sizeDesc); return this; }
public StoreConfig overrideMaxPerEntryBufferSize(String sizeDesc) { maxPerEntryBuffering = new DataAmount(sizeDesc); return this; }
public StoreConfig overrideMaxPerEntryBufferSize(long sizeInBytes) { maxPerEntryBuffering = new DataAmount(sizeInBytes); return this; }
public BDBJEConfig overrideCacheSize(long cacheSizeInBytes) { cacheSize = new DataAmount(cacheSizeInBytes); return this; }
public BDBJEConfig overrideCacheSize(String cacheSizeDesc) { cacheSize = new DataAmount(cacheSizeDesc); return this; }
public DataAmount convertTo(DataAmountUnit unit) { return new DataAmount(numBytes / unit.getFactor(), unit); }
public DataAmount convertTo(DataAmountUnit newUnit) { return new DataAmount(numBytes / newUnit.getFactor(), newUnit); }