com.sleepycat.je.CheckpointConfig Java Examples

The following examples show how to use com.sleepycat.je.CheckpointConfig. 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: StandardEnvironmentFacade.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
@Override
public void checkpoint(final boolean force)
{
    CheckpointConfig ckptConfig = new CheckpointConfig();
    ckptConfig.setForce(force);
    getEnvironment().checkpoint(ckptConfig);
}
 
Example #2
Source File: BDBUtils.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
public synchronized static void runCleaner(final Environment environment)
{
    if (environment == null || !environment.isValid())
    {
        return;
    }

    boolean cleanerWasRunning = Boolean.parseBoolean(environment.getConfig().getConfigParam(EnvironmentConfig.ENV_RUN_CLEANER));

    try
    {
        if (cleanerWasRunning)
        {
            environment.getConfig().setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, Boolean.FALSE.toString());
        }

        if (LOGGER.isDebugEnabled())
        {
            LOGGER.debug("Cleaning logs");
        }

        boolean cleaned = false;
        while (environment.cleanLog() > 0)
        {
            cleaned = true;
        }
        if (cleaned)
        {
            LOGGER.debug("Cleaned log");

            CheckpointConfig force = new CheckpointConfig();
            force.setForce(true);
            environment.checkpoint(force);

            LOGGER.debug("Checkpoint force complete");
        }
    }
    finally
    {
        if (cleanerWasRunning)
        {
            environment.getConfig().setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, Boolean.TRUE.toString());
        }
    }

}
 
Example #3
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);
	}
}