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

The following examples show how to use com.sleepycat.je.EnvironmentConfig#setSharedCache() . 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: TestKDTreeSplit.java    From bboxdb with Apache License 2.0 6 votes vote down vote up
public TestKDTreeSplit(final File tmpDir, final List<Pair<String, String>> filesAndFormats,
		final List<Integer> experimentSize) {

	this.filesAndFormats = filesAndFormats;
	this.experimentSize = experimentSize;

	this.elements = new HashMap<>();
	this.elementCounter = new HashMap<>();
	this.boxDimension = new HashMap<>();

	// Setup database dir
	tmpDir.mkdirs();
	FileUtil.deleteDirOnExit(tmpDir.toPath());

	final EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setTransactional(false);
	envConfig.setAllowCreate(true);
    envConfig.setSharedCache(true);
	dbEnv = new Environment(tmpDir, envConfig);

	dbConfig = new DatabaseConfig();
	dbConfig.setTransactional(false);
	dbConfig.setAllowCreate(true);
}
 
Example 2
Source File: FileLineIndex.java    From bboxdb with Apache License 2.0 6 votes vote down vote up
/**
 * Open the Berkeley DB
 * @throws IOException
 */
protected void openDatabase() throws IOException {
	final EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setTransactional(false);
	envConfig.setAllowCreate(true);
    envConfig.setSharedCache(true);

    tmpDatabaseDir = Files.createTempDirectory(null);
	dbEnv = new Environment(tmpDatabaseDir.toFile(), envConfig);

	logger.info("Database dir is {}", tmpDatabaseDir);

	// Delete database on exit
	FileUtil.deleteDirOnExit(tmpDatabaseDir);

	final DatabaseConfig dbConfig = new DatabaseConfig();
	dbConfig.setTransactional(false);
	dbConfig.setAllowCreate(true);
	dbConfig.setDeferredWrite(true);

	database = dbEnv.openDatabase(null, "lines", dbConfig);
}
 
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: BdbPersistentEnvironmentCreator.java    From timbuctoo with GNU General Public License v3.0 5 votes vote down vote up
@JsonCreator
public BdbPersistentEnvironmentCreator(@JsonProperty("databaseLocation") String databaseLocation) {
  this.databaseLocation = databaseLocation;
  configuration = new EnvironmentConfig(new Properties());
  configuration.setTransactional(true);
  configuration.setDurability(Durability.COMMIT_NO_SYNC);
  configuration.setAllowCreate(true);
  configuration.setSharedCache(true);
  bdbBackupper = new BdbBackupper();
}
 
Example 5
Source File: BdbNonPersistentEnvironmentCreator.java    From timbuctoo with GNU General Public License v3.0 5 votes vote down vote up
public BdbNonPersistentEnvironmentCreator() {
  configuration = new EnvironmentConfig(new Properties());
  configuration.setTransactional(true);
  configuration.setAllowCreate(true);
  configuration.setSharedCache(true);
  dbHome = Files.createTempDir();
  databases = Maps.newHashMap();
  environmentMap = Maps.newHashMap();
}
 
Example 6
Source File: OSMBDBNodeStore.java    From bboxdb with Apache License 2.0 4 votes vote down vote up
public OSMBDBNodeStore(final List<String> baseDir, final long inputLength) {

		if(baseDir.size() == 1) {
			this.instances = 4;
		} else {
			this.instances = baseDir.size();
		}
		
		// Prepare DB_Instances
		for (int i = 0; i < this.instances; i++) {

			final String workfolder = baseDir.get(i % baseDir.size());
			final String folderName = workfolder + "/osm_" + i;
			final File folder = new File(folderName);
			
			if(folder.exists()) {
				System.err.println("Folder already exists, exiting: " + folderName);
				System.exit(-1);
			}
			
			folder.mkdirs();

			pendingWriteQueues.add(new LinkedList<SerializableNode>());
			
			final EnvironmentConfig envConfig = new EnvironmentConfig();
			envConfig.setTransactional(USE_TRANSACTIONS);
			envConfig.setAllowCreate(true);
		    envConfig.setSharedCache(true);
		   // envConfig.setCachePercent(80);
		   /* 
		    envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false");
		    envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CHECKPOINTER, "false");
		    envConfig.setConfigParam(EnvironmentConfig.ENV_RUN_IN_COMPRESSOR, "false");
		*/	
			initNewBDBEnvironment(folder, envConfig);

			final BDBWriterRunnable bdbWriter = new BDBWriterRunnable(pendingWriteQueues.get(i), 
					environments.get(i), databases.get(i));
			
			threadPool.submit(bdbWriter);
		}

	}