Java Code Examples for com.sleepycat.je.EnvironmentConfig#setConfigParam()

The following examples show how to use com.sleepycat.je.EnvironmentConfig#setConfigParam() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JE_Repository.java    From tddl5 with Apache License 2.0 6 votes vote down vote up
public void commonConfig(EnvironmentConfig envConfig) {
    System.setProperty("JEMonitor", "true");
    envConfig.setConfigParam(EnvironmentConfig.NODE_MAX_ENTRIES, "256");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_EVICT_BYTES, (1024 * 1024 * 2) + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_NODES_PER_SCAN, "10");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY, "false");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_FORCED_YIELD, "true");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_CORE_THREADS, Runtime.getRuntime().availableProcessors()
                                                                     + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_MAX_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_BYTES_INTERVAL, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION, "true");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, 1024 * 1024 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_CACHE_SIZE, "1024");
    envConfig.setConfigParam(EnvironmentConfig.LOG_USE_WRITE_QUEUE, "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_WRITE_QUEUE_SIZE, 1024 * 1024 * 2 + "");
    // envConfig.setConfigParam(EnvironmentConfig.HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION,
    // "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_ITERATOR_READ_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOCK_TIMEOUT, 2000 + "\tMILLISECONDS");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RECOVERY_FORCE_CHECKPOINT, "true");
}
 
Example 2
Source File: JE_Repository.java    From tddl with Apache License 2.0 6 votes vote down vote up
public void commonConfig(EnvironmentConfig envConfig) {
    System.setProperty("JEMonitor", "true");
    envConfig.setConfigParam(EnvironmentConfig.NODE_MAX_ENTRIES, "256");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_EVICT_BYTES, (1024 * 1024 * 2) + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_NODES_PER_SCAN, "10");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY, "false");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_FORCED_YIELD, "true");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_CORE_THREADS, Runtime.getRuntime().availableProcessors()
                                                                     + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_MAX_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_BYTES_INTERVAL, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION, "true");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, 1024 * 1024 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_CACHE_SIZE, "1024");
    envConfig.setConfigParam(EnvironmentConfig.LOG_USE_WRITE_QUEUE, "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_WRITE_QUEUE_SIZE, 1024 * 1024 * 2 + "");
    // envConfig.setConfigParam(EnvironmentConfig.HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION,
    // "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_ITERATOR_READ_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOCK_TIMEOUT, 2000 + "\tMILLISECONDS");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RECOVERY_FORCE_CHECKPOINT, "true");
}
 
Example 3
Source File: AbstractUpgradeTestCase.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
protected Environment createEnvironment(File storeLocation)
{
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setConfigParam("je.lock.nLockTables", "7");
    envConfig.setReadOnly(false);
    envConfig.setSharedCache(false);
    envConfig.setCacheSize(0);
    return new Environment(storeLocation, envConfig);
}
 
Example 4
Source File: JE_Repository.java    From tddl5 with Apache License 2.0 5 votes vote down vote up
public void commonConfig(EnvironmentConfig envConfig, BDBConfig config) {
    System.setProperty("JEMonitor", "true");
    envConfig.setConfigParam(EnvironmentConfig.NODE_MAX_ENTRIES, "256");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_EVICT_BYTES, (1024 * 1024 * 2) + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_NODES_PER_SCAN, "10");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY, "false");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_FORCED_YIELD, "true");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_CORE_THREADS, Runtime.getRuntime().availableProcessors()
                                                                     + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_MAX_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_BYTES_INTERVAL, 1024 * 1024 * 200 + "");

    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, 1024 * 1024 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, 3 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_CACHE_SIZE, "1024");
    envConfig.setConfigParam(EnvironmentConfig.LOG_USE_WRITE_QUEUE, "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_WRITE_QUEUE_SIZE, 1024 * 1024 * 2 + "");
    // envConfig.setConfigParam(EnvironmentConfig.HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION,
    // "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_ITERATOR_READ_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOCK_TIMEOUT, 2000 + "\tMILLISECONDS");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RECOVERY_FORCE_CHECKPOINT, "true");

    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MIN_UTILIZATION, (config.getCleaner_min_utilization()));
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION, config.getCleanerLazyMigration());
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, config.getCleanerThreadCount() + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, config.getCleanerBatchFileCount() + "");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, config.getAutoClean() ? "true" : "false");

}
 
Example 5
Source File: JE_Repository.java    From tddl with Apache License 2.0 5 votes vote down vote up
public void commonConfig(EnvironmentConfig envConfig, BDBConfig config) {
    System.setProperty("JEMonitor", "true");
    envConfig.setConfigParam(EnvironmentConfig.NODE_MAX_ENTRIES, "256");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_EVICT_BYTES, (1024 * 1024 * 2) + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_NODES_PER_SCAN, "10");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_LRU_ONLY, "false");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_FORCED_YIELD, "true");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_CORE_THREADS, Runtime.getRuntime().availableProcessors()
                                                                     + "");
    envConfig.setConfigParam(EnvironmentConfig.EVICTOR_MAX_THREADS, Runtime.getRuntime().availableProcessors() + "");
    envConfig.setConfigParam(EnvironmentConfig.CHECKPOINTER_BYTES_INTERVAL, 1024 * 1024 * 200 + "");

    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, 1024 * 1024 + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, 3 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, 1024 * 1024 * 200 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_CACHE_SIZE, "1024");
    envConfig.setConfigParam(EnvironmentConfig.LOG_USE_WRITE_QUEUE, "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_WRITE_QUEUE_SIZE, 1024 * 1024 * 2 + "");
    // envConfig.setConfigParam(EnvironmentConfig.HALT_ON_COMMIT_AFTER_CHECKSUMEXCEPTION,
    // "true");
    envConfig.setConfigParam(EnvironmentConfig.LOG_ITERATOR_READ_SIZE, 1024 * 8 + "");
    envConfig.setConfigParam(EnvironmentConfig.LOCK_TIMEOUT, 2000 + "\tMILLISECONDS");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RECOVERY_FORCE_CHECKPOINT, "true");

    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MIN_UTILIZATION, (config.getCleaner_min_utilization()));
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_LAZY_MIGRATION, config.getCleanerLazyMigration());
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, config.getCleanerThreadCount() + "");
    envConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, config.getCleanerBatchFileCount() + "");
    envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, config.getAutoClean() ? "true" : "false");

}
 
Example 6
Source File: StandardEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
public StandardEnvironmentFacade(StandardEnvironmentConfiguration configuration)
{
    _storePath = configuration.getStorePath();

    if (LOGGER.isInfoEnabled())
    {
        LOGGER.info("Creating environment at environment path " + _storePath);
    }

    _environmentPath = new File(_storePath);
    if (!_environmentPath.exists())
    {
        if (!_environmentPath.mkdirs())
        {
            throw new IllegalArgumentException("Environment path " + _environmentPath + " could not be read or created. "
                                               + "Ensure the path is correct and that the permissions are correct.");
        }
    }
    else if(_environmentPath.isFile())
    {
        throw new IllegalArgumentException("Environment path " + _environmentPath + " exists as a file - not a directory. "
                                           + "Ensure the path is correct.");

    }

    String name = configuration.getName();
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setCacheMode(configuration.getCacheMode());
    envConfig.setLoggingHandler(new Slf4jLoggingHandler(configuration));

    LOGGER.debug("Cache mode {}", envConfig.getCacheMode());

    Map<String, String> params = new HashMap<>(EnvironmentFacade.ENVCONFIG_DEFAULTS);
    params.putAll(configuration.getParameters());

    for (Map.Entry<String, String> configItem : params.entrySet())
    {
        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Setting EnvironmentConfig key "
                         + configItem.getKey()
                         + " to '"
                         + configItem.getValue()
                         + "'");
        }
        envConfig.setConfigParam(configItem.getKey(), configItem.getValue());
    }

    envConfig.setExceptionListener(new LoggingAsyncExceptionListener());

    DbInternal.setLoadPropertyFile(envConfig, false);

    File propsFile = new File(_environmentPath, "je.properties");
    if(propsFile.exists())
    {
        LOGGER.warn("The BDB configuration file at '" + _environmentPath + File.separator +  "je.properties' will NOT be loaded.  Configure BDB using Qpid context variables instead.");
    }

    EnvHomeRegistry.getInstance().registerHome(_environmentPath);

    boolean success = false;
    try
    {
        _environment = new AtomicReference<>(new Environment(_environmentPath, envConfig));
        success = true;
    }
    finally
    {
        if (!success)
        {
            EnvHomeRegistry.getInstance().deregisterHome(_environmentPath);
        }
    }

    _committer =  new CoalescingCommiter(name, this);
    _committer.start();
}
 
Example 7
Source File: BJEStorageImplementation.java    From hypergraphdb with Apache License 2.0 4 votes vote down vote up
public void startup(HGStore store, HGConfiguration config)
{
	this.store = store;
	this.handleFactory = config.getHandleFactory();
	this.linkBinding = new LinkBinding(handleFactory);
	EnvironmentConfig envConfig = configuration.getEnvironmentConfig();
	envConfig.setConfigParam(EnvironmentConfig.CLEANER_THREADS, "5");
	envConfig.setClassLoader(new HGClassLoaderDelegate(config));
	if (config.isTransactional())
	{
		configuration.configureTransactional();
	}

	File envDir = new File(store.getDatabaseLocation());
	envDir.mkdirs();

	try
	{
		env = new Environment(envDir, envConfig);
		data_db = env.openDatabase(null, DATA_DB_NAME, configuration.getDatabaseConfig().clone());
		primitive_db = env.openDatabase(null, PRIMITIVE_DB_NAME, configuration.getDatabaseConfig().clone());

		DatabaseConfig incConfig = configuration.getDatabaseConfig().clone();
		incConfig.setSortedDuplicates(true);
		incidence_db = env.openDatabase(null, INCIDENCE_DB_NAME, incConfig);

		openIndices = new HashMap<String, HGIndex<?, ?>>(); // force reset
															// since startup
															// can follow a
															// shutdown on
															// same opened
															// class

		if (config.isTransactional())
		{
			CheckpointConfig ckptConfig = new CheckpointConfig();
			// System.out.println("checkpoint kbytes:" +
			// ckptConfig.getKBytes());
			// System.out.println("checkpoint minutes:" +
			// ckptConfig.getMinutes());
			env.checkpoint(null);
			checkPointThread = new CheckPointThread();
			checkPointThread.start();
		}
	}
	catch (Exception ex)
	{
		throw new HGException("Failed to initialize HyperGraph data store: " + ex.toString(), ex);
	}
}