@Override public boolean getEnvIsReadonly() { return config.getEnvIsReadonly(); }
private boolean throwCantModify() { if (getEnvironment().getEnvironmentConfig().getEnvIsReadonly()) { throw new ReadonlyTransactionException(); } throw new UnsupportedOperationException("Can't modify temporary empty store"); } }
@NotNull public ReadWriteTransaction beginGCTransaction() { if (ec.getEnvIsReadonly()) { throw new ReadonlyTransactionException("Can't start GC transaction on read-only Environment"); } return new ReadWriteTransaction(this, null, ec.getGcUseExclusiveTransaction(), true) { @Override boolean isGCTransaction() { return true; } }; }
@NotNull protected TransactionBase beginTransaction(Runnable beginHook, boolean exclusive, boolean cloneMeta) { checkIsOperative(); return ec.getEnvIsReadonly() ? new ReadonlyTransaction(this, exclusive, beginHook) : new ReadWriteTransaction(this, beginHook, exclusive, cloneMeta); }
@Override public void afterSettingChanged(@NotNull String key, @NotNull Object value, @NotNull Map<String, Object> context) { if (key.equals(EnvironmentConfig.ENV_STOREGET_CACHE_SIZE) || key.equals(EnvironmentConfig.ENV_STOREGET_CACHE_MIN_TREE_SIZE) || key.equals(EnvironmentConfig.ENV_STOREGET_CACHE_MAX_VALUE_SIZE)) { invalidateStoreGetCache(); } else if (key.equals(EnvironmentConfig.LOG_SYNC_PERIOD)) { log.getConfig().setSyncPeriod(ec.getLogSyncPeriod()); } else if (key.equals(EnvironmentConfig.LOG_DURABLE_WRITE)) { log.getConfig().setDurableWrite(ec.getLogDurableWrite()); } else if (key.equals(EnvironmentConfig.ENV_IS_READONLY) && !ec.getEnvIsReadonly()) { resumeGC(); } else if (key.equals(EnvironmentConfig.GC_UTILIZATION_FROM_SCRATCH) && ec.getGcUtilizationFromScratch()) { gc.getUtilizationProfile().computeUtilizationFromScratch(); } else if (key.equals(EnvironmentConfig.GC_UTILIZATION_FROM_FILE)) { gc.getUtilizationProfile().loadUtilizationFromFile((String) value); } else if (key.equals(EnvironmentConfig.TREE_MAX_PAGE_SIZE)) { balancePolicy = null; } else if (key.equals(EnvironmentConfig.LOG_CACHE_READ_AHEAD_MULTIPLE)) { log.getConfig().setCacheReadAheadMultiple(ec.getLogCacheReadAheadMultiple()); } } }
if (ec.getEnvIsReadonly()) { throw new ReadonlyTransactionException();
if (!ec.getEnvIsReadonly() && ec.isGcEnabled()) { executeInTransaction(new TransactionalExecutable() { @Override