@Override public void setEnvCloseForcedly(boolean closeForcedly) { config.setEnvCloseForcedly(closeForcedly); }
@Override public void setGcUtilizationFromScratch(boolean fromScratch) { config.setGcUtilizationFromScratch(fromScratch); }
@Override public boolean getEnvCloseForcedly() { return config.getEnvCloseForcedly(); }
@NotNull public static Log newLogInstance(@NotNull final LogConfig config, @NotNull final EnvironmentConfig ec) { final Long maxMemory = ec.getMemoryUsage(); if (maxMemory != null) { config.setMemoryUsage(maxMemory); } else { config.setMemoryUsagePercentage(ec.getMemoryUsagePercentage()); } config.setReaderWriterProvider(ec.getLogDataReaderWriterProvider()); if (config.getReaderWriterProvider().isReadonly()) { ec.setEnvIsReadonly(true); config.setLockIgnored(true); } return newLogInstance(config. setFileSize(ec.getLogFileSize()). setLockTimeout(ec.getLogLockTimeout()). setCachePageSize(ec.getLogCachePageSize()). setCacheOpenFilesCount(ec.getLogCacheOpenFilesCount()). setDurableWrite(ec.getLogDurableWrite()). setSharedCache(ec.isLogCacheShared()). setNonBlockingCache(ec.isLogCacheNonBlocking()). setCacheGenerationCount(ec.getLogCacheGenerationCount()). setCleanDirectoryExpected(ec.isLogCleanDirectoryExpected()). setClearInvalidLog(ec.isLogClearInvalid()). setSyncPeriod(ec.getLogSyncPeriod()). setFullFileReadonly(ec.isLogFullFileReadonly()). setCipherProvider(ec.getCipherId() == null ? null : KryptKt.newCipherProvider(ec.getCipherId())). setCipherKey(ec.getCipherKey()). setCipherBasicIV(ec.getCipherBasicIV())); }
private EnvironmentConfig makeEnvironmentConfig( final Map<String, String> initParameters ) final EnvironmentConfig environmentConfig = new EnvironmentConfig(); environmentConfig.setEnvCloseForcedly( true ); environmentConfig.setMemoryUsage( 50 * 1024 * 1024 ); environmentConfig.setEnvGatherStatistics( true ); environmentConfig.setGcUtilizationFromScratch( true ); LOGGER.warn( "environment not closed cleanly, will re-calculate GC" ); try environmentConfig.setSettings( singleMap ); LOGGER.trace( () -> "set env setting from appProperty: " + key + "=" + value );
protected Environment getEnv(String envKey) { Environment env = envs.get(envKey); if (env == null) synchronized (envs) { env = envs.get(envKey); if (env == null) { checkVersion(envKey); EnvironmentConfig config = new EnvironmentConfig(); config.setEnvCloseForcedly(true); config.setMemoryUsagePercentage(MEMORY_USAGE_PERCENT); config.setLogFileSize(getLogFileSize()); env = Environments.newInstance(getEnvDir(envKey), config); envs.put(envKey, env); } } return env; }
@NotNull public static ContextualEnvironment newContextualInstance(@NotNull final File dir) { return newContextualInstance(dir, new EnvironmentConfig()); }
invalidateStoreGetCache(); envSettingsListener = new EnvironmentSettingsListener(); ec.addChangedSettingsListener(envSettingsListener); metaWriteLock = metaLock.writeLock(); txnDispatcher = new ReentrantTransactionDispatcher(ec.getEnvMaxParallelTxns()); roTxnDispatcher = new ReentrantTransactionDispatcher(ec.getEnvMaxParallelReadonlyTxns()); if (ec.isManagementEnabled()) { configMBean = ec.getManagementOperationsRestricted() ? new jetbrains.exodus.env.management.EnvironmentConfig(this) : new EnvironmentConfigWithOperations(this); statisticsMBean = ec.getEnvGatherStatistics() ? new jetbrains.exodus.env.management.EnvironmentStatistics(this) : null; } else { configMBean = null;
final MetaServer metaServer = getEnvironmentConfig().getMetaServer(); if (metaServer != null) { metaServer.stop(this); throw new EnvironmentClosedException(throwableOnClose); // add combined stack trace information checkInactive(ec.getEnvCloseForcedly()); try { if (!ec.getEnvIsReadonly() && ec.isGcEnabled()) { executeInTransaction(new TransactionalExecutable() { @Override ec.removeChangedSettingsListener(envSettingsListener); logCacheHitRate = log.getCacheHitRate(); log.close();
@Override public boolean getEnvGatherStatistics() { return config.getEnvGatherStatistics(); }
@NotNull public static ContextualEnvironment newContextualInstance(@NotNull final String dir) { return newContextualInstance(dir, new EnvironmentConfig()); }
@NotNull @Override public StatisticsItem getStatisticsItem(@NotNull final String statisticsName) { // if don't gather statistics just return the new item and don't register it as periodic task in SharedTimer if (!env.getEnvironmentConfig().getEnvGatherStatistics()) { return new StatisticsItem(this); } return super.getStatisticsItem(statisticsName); }
@NotNull public static Environment newInstance(@NotNull final String dir) { return newInstance(dir, new EnvironmentConfig()); }
@Override protected StatisticsItem createStatisticsItem(@NotNull Type key) { // if don't gather statistics just return the new item and don't register it as periodic task in SharedTimer if (!env.getEnvironmentConfig().getEnvGatherStatistics()) { return new StatisticsItem(this); } return super.createStatisticsItem(key); }
@NotNull public static Environment newInstance(@NotNull final File dir) { return newInstance(dir, new EnvironmentConfig()); }
@NotNull public static Environment newInstance(@NotNull final LogConfig config) { return newInstance(config, new EnvironmentConfig()); }