當前位置: 首頁>>代碼示例>>Java>>正文


Java EnvironmentConfig.setCacheSize方法代碼示例

本文整理匯總了Java中com.sleepycat.je.EnvironmentConfig.setCacheSize方法的典型用法代碼示例。如果您正苦於以下問題:Java EnvironmentConfig.setCacheSize方法的具體用法?Java EnvironmentConfig.setCacheSize怎麽用?Java EnvironmentConfig.setCacheSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sleepycat.je.EnvironmentConfig的用法示例。


在下文中一共展示了EnvironmentConfig.setCacheSize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: UpdateGroundhogScript

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public UpdateGroundhogScript(File datadir) throws DatabaseException {
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(true);
  environmentConfig.setCacheSize(302400000);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);
  List<String> names = environment.getDatabaseNames();
  if (names.contains(datadir.getName())) {
    environment.renameDatabase(null, datadir.getName(), databaseName);
  }
  environment.close();
}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:17,代碼來源:UpdateGroundhogScript.java

示例2: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private void init(File datadir){
  try {
    environmentConfig = new EnvironmentConfig();
    environmentConfig.setAllowCreate(true);
    environmentConfig.setTransactional(true);
    environmentConfig.setCacheSize(30240000);

    environment = new Environment(datadir, environmentConfig);

    databaseConfig = new DatabaseConfig();
    databaseConfig.setAllowCreate(true);
    databaseConfig.setTransactional(true);

    openDB();

    myIntegerBinding = TupleBinding.getPrimitiveBinding(Integer.class);
    myDataBinding = new IntegerToSetOfIntegersBinding();
    
    sh = new IntegerSetStoreShutdown();
    sh.g = this;
    Runtime.getRuntime().addShutdownHook(sh);
  } catch (DatabaseException e) {
    e.printStackTrace();
  }

}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:27,代碼來源:IntegerSetStore.java

示例3: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private void init(File datadir){
  try {
    environmentConfig = new EnvironmentConfig();
    environmentConfig.setAllowCreate(true);
    environmentConfig.setTransactional(true);
    environmentConfig.setCacheSize(30240000);

    environment = new Environment(datadir, environmentConfig);

    databaseConfig = new DatabaseConfig();
    databaseConfig.setAllowCreate(true);
    databaseConfig.setTransactional(true);

    openDB();

    myIntegerBinding = TupleBinding.getPrimitiveBinding(Integer.class);
    myDataBinding = new Integer2Integer2IntegerMapBinding();
    
    sh = new CooccurrenceDatabaseShutdown();
    sh.c = this;
    Runtime.getRuntime().addShutdownHook(sh);
  } catch (DatabaseException e) {
    e.printStackTrace();
  }

}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:27,代碼來源:CooccurrenceDatabase.java

示例4: initialize

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private void initialize() throws DatabaseException{
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(false);
  environmentConfig.setCacheSize(cachesize);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);

  databaseConfig = new DatabaseConfig();
  databaseConfig.setAllowCreate(true);
  databaseConfig.setTransactional(false);

  // perform other database configurations

  openDB();

  // add a shutdown hook to close the database when the VM is terminated
  sh = new Shutdown();
  sh.cache = this;
  Runtime.getRuntime().addShutdownHook(sh);
}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:24,代碼來源:SleepyCatStoreCache.java

示例5: testBasicParams

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
    * Test that parameter defaults work, that we can add and get
    * parameters
    */
   public void testBasicParams()
throws DatabaseException {

       EnvironmentConfig envConfig = TestUtils.initEnvConfig();
       envConfig.setCacheSize(2000);
       DbConfigManager configManager = new DbConfigManager(envConfig);

       /**
        * Longs: The config manager should return the value for an
        * explicitly set param and the default for one not set.
        *
        */
       assertEquals(2000,
                    configManager.getLong(EnvironmentParams.MAX_MEMORY));
       assertEquals(EnvironmentParams.ENV_RECOVERY.getDefault(),
                    configManager.get(EnvironmentParams.ENV_RECOVERY));
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:22,代碼來源:DbConfigManagerTest.java

示例6: initalize

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private void initalize() throws DatabaseException {
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(true);
  environmentConfig.setCacheSize(cachesize);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);

  databaseConfig = new DatabaseConfig();
  databaseConfig.setAllowCreate(true);
  databaseConfig.setTransactional(true);

  // perform other database configurations
  openDB();
  recordDatabaseBinding = new RecordDataBaseBinding();
  integerBinding = TupleBinding.getPrimitiveBinding(Integer.class);
  tempkeyBinding = new BatchNumberAndIntegerIDBinding();
  conceptToRecordIndexEntryBinding = new ConceptToRecordIndexEntryBinding(ComparatorFactory.getAscendingIntegerComparator());
  // this.ontology = new SimpleOntologyImplementation();
  recordDatabaseBinding.ontology = ontology;
  conceptIndex = new ConceptToRecordIndex(environment, ComparatorFactory.getAscendingIntegerComparator());
  conceptFrequencyCache = new ConceptFrequencyCache(conceptIndex);
  conceptSumOfValuesCache = new ConceptSumOfValuesCache(conceptIndex);

  gsh = new GroundhogShutdown();
  gsh.g = this;
  Runtime.getRuntime().addShutdownHook(gsh);

}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:32,代碼來源:Groundhog.java

示例7: UpdataIntegerSetStoreScript

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public UpdataIntegerSetStoreScript(File datadir) throws DatabaseException {
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(true);
  environmentConfig.setCacheSize(302400000);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);
  List<String> names = environment.getDatabaseNames();
  if (names.contains(datadir.getName())) {
    environment.renameDatabase(null, datadir.getName(), databaseName);
  }
  environment.close();
}
 
開發者ID:BiosemanticsDotOrg,項目名稱:GeneDiseasePaper,代碼行數:16,代碼來源:UpdataIntegerSetStoreScript.java

示例8: createDatabase

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private void createDatabase(long cacheSize, long maxFileSize)
throws DatabaseException {

       EnvironmentConfig envConfig = TestUtils.initEnvConfig();
       envConfig.setTransactional(true);
       envConfig.setAllowCreate(true);
envConfig.setConfigParam
    (EnvironmentParams.NUM_LOG_BUFFERS.getName(), "2");
envConfig.setConfigParam
    (EnvironmentParams.LOG_MEM_SIZE.getName(),
     EnvironmentParams.LOG_MEM_SIZE_MIN_STRING);
if (maxFileSize != 0) {
    DbInternal.disableParameterValidation(envConfig);
    envConfig.setConfigParam
	(EnvironmentParams.LOG_FILE_MAX.getName(), "" + maxFileSize);
}
if (cacheSize != 0) {
    envConfig.setCacheSize(cacheSize);
    envConfig.setConfigParam("java.util.logging.level", "OFF");
}
env = new Environment(envHome, envConfig);

       String databaseName = "ioexceptiondb";
       DatabaseConfig dbConfig = new DatabaseConfig();
       dbConfig.setAllowCreate(true);
       dbConfig.setSortedDuplicates(true);
dbConfig.setTransactional(true);
       db = env.openDatabase(null, databaseName, dbConfig);
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:30,代碼來源:IOExceptionTest.java

示例9: testRemoveNonPersistentDbSR15317

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
    * Check that all INs are removed from the INList for a DB that is removed
    * before it is sync'ed (or checkpointed).  Before the bug fix, INs were
    * not removed if the DB root IN was never logged (was still null).  This
    * caused a DatabaseException when evicting, because the evictor expects no
    * INs for deleted DBs on the INList.
    */
   public void testRemoveNonPersistentDbSR15317()
throws Throwable {

Database db = null;
try {
    EnvironmentConfig envConfig = getEnvConfig(true);
           /* Disable compressor for test predictability. */
           envConfig.setConfigParam("je.env.runINCompressor", "false");
    env = new Environment(envHome, envConfig);
    db = createDb(true);
           /* Insert some data to cause eviction later. */
           insert(db,
                  null,          // txn
                  1,             // start
                  30000,         // end
                  new HashSet(), // expected
                  false);        // useRandom
           db.close();
           env.removeDatabase(null, DBNAME);

           envConfig = env.getConfig();
           /* Switch to a small cache to force eviction. */
           envConfig.setCacheSize(96 * 1024);
           env.setMutableConfig(envConfig);
           for (int i = 0; i < 10; i += 1) {
               env.evictMemory();
           }
       } finally {
           if (env != null) {
               try {
                   env.close();
               } catch (Throwable e) {
                   System.out.println("Ignored: " + e);
               }
               env = null;
           }
       }
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:46,代碼來源:DeferredWriteTest.java

示例10: testRecoverNoSyncEvict

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public void testRecoverNoSyncEvict()
    throws Throwable {

    EnvironmentConfig envConfig = getEnvConfig(true);
    envConfig.setCacheSize(MemoryBudget.MIN_MAX_MEMORY_SIZE);
    doRecover(envConfig,
              3000,    /* numRecords */
              false,  /* syncBeforeRecovery. */
              true);  /* expectEviction */
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:11,代碼來源:DeferredWriteTest.java

示例11: testRecoverSyncEvict

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public void testRecoverSyncEvict()
    throws Throwable {

    EnvironmentConfig envConfig = getEnvConfig(true);
    envConfig.setCacheSize(MemoryBudget.MIN_MAX_MEMORY_SIZE);
    doRecover(envConfig,
              3000,    /* numRecords */
              true,  /* syncBeforeRecovery. */
              true);  /* expectEviction */
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:11,代碼來源:DeferredWriteTest.java

示例12: testRemoveNonPersistentDbSR15317

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
    * Check that all INs are removed from the INList for a DB that is removed
    * before it is sync'ed (or checkpointed).  Before the bug fix, INs were
    * not removed if the DB root IN was never logged (was still null).  This
    * caused a DatabaseException when evicting, because the evictor expects no
    * INs for deleted DBs on the INList.
    */
   public void testRemoveNonPersistentDbSR15317()
throws Throwable {

Database db = null;
try {
    EnvironmentConfig envConfig = getEnvConfig(true);
           /* Disable compressor for test predictability. */
           envConfig.setConfigParam("je.env.runINCompressor", "false");
    env = new Environment(envHome, envConfig);
    db = createDb(true);
           /* Insert some data to cause eviction later. */
           insert(db, 
                  null,          // txn
                  1,             // start
                  30000,         // end
                  new HashSet(), // expected
                  false);        // useRandom
           db.close();
           env.removeDatabase(null, DBNAME);

           envConfig = env.getConfig();
           /* Switch to a small cache to force eviction. */
           envConfig.setCacheSize(96 * 1024);
           env.setMutableConfig(envConfig);
           for (int i = 0; i < 10; i += 1) {
               env.evictMemory();
           }
       } finally {
           if (env != null) {
               try {
                   env.close();
               } catch (Throwable e) {
                   System.out.println("Ignored: " + e);
               }
               env = null;
           }
       }
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:46,代碼來源:DeferredWriteTest.java

示例13: testRecoverNoSyncEvict

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public void testRecoverNoSyncEvict()
    throws Throwable {

    EnvironmentConfig envConfig = getEnvConfig(true);
    envConfig.setCacheSize(MemoryBudget.MIN_MAX_MEMORY_SIZE);
    doRecover(envConfig, 
              3000,    /* numRecords */
              false,  /* syncBeforeRecovery. */
              true);  /* expectEviction */
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:11,代碼來源:DeferredWriteTest.java

示例14: testRecoverSyncEvict

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public void testRecoverSyncEvict()
    throws Throwable {

    EnvironmentConfig envConfig = getEnvConfig(true);
    envConfig.setCacheSize(MemoryBudget.MIN_MAX_MEMORY_SIZE);
    doRecover(envConfig, 
              3000,    /* numRecords */
              true,  /* syncBeforeRecovery. */
              true);  /* expectEviction */
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:11,代碼來源:DeferredWriteTest.java

示例15: connect

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
protected void connect(boolean isReadOnly, boolean allowCreateNew,
		boolean overwriteExisting, final Long cacheSize) throws DatabaseException {
	// Configure DB environment.
	EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setAllowCreate(allowCreateNew);
	envConfig.setReadOnly(isReadOnly);
	envConfig.setTransactional(false);
	if (cacheSize != null)
		envConfig.setCacheSize(cacheSize);
	env = new Environment(dbPath, envConfig);

	// Configure store.
	StoreConfig storeConfig = new StoreConfig();
	storeConfig.setAllowCreate(allowCreateNew);
	storeConfig.setTransactional(false);
	storeConfig.setReadOnly(isReadOnly);
	store = new EntityStore(env, DATABASE_NAME, storeConfig);

	// Load properties.
	properties = new Properties();
	File propFile = new File(dbPath, PROPERTY_FILE_NAME);
	if (propFile.exists()) {
		try {
			try (Reader reader = new InputStreamReader(new FileInputStream(propFile), "UTF-8")) {
				properties.load(reader);
			}
		} catch (IOException e) {
			throw new DatabaseException("Unable to load property file", e){};
		}

		String lang = properties.getProperty("wiktionary.language");
		if (lang == null)
			lang = properties.getProperty("entry_language");
		language = Language.get(lang);
	}

	// Load index.
	pageById = store.getPrimaryIndex(Long.class, WiktionaryPage.class);
	pageByTitle = store.getSecondaryIndex(pageById, String.class, "title");
	pageByNormalizedTitle = store.getSecondaryIndex(pageById, String.class, "normalizedTitle");

	entryByKey = store.getPrimaryIndex(String.class, WiktionaryEntryProxy.class);
	entryById = store.getSecondaryIndex(entryByKey, Long.class, "entryId");
	senseByKey = store.getPrimaryIndex(String.class, WiktionarySenseProxy.class);

	openCursors = new HashSet<>();
}
 
開發者ID:dkpro,項目名稱:dkpro-jwktl,代碼行數:48,代碼來源:BerkeleyDBWiktionaryEdition.java


注:本文中的com.sleepycat.je.EnvironmentConfig.setCacheSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。