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


Java EnvironmentConfig類代碼示例

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


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

示例1: main

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
public static void main(String [] args) throws Exception
{
    EnvironmentConfig v_EnvConfig = new EnvironmentConfig();
    DatabaseConfig    v_DBConfig  = new DatabaseConfig();
    Berkeley          v_Berkeley  = new Berkeley();
    
    v_EnvConfig.setAllowCreate(true);
    v_DBConfig.setAllowCreate(true);
    
    v_Berkeley.setEnvironmentConfig(v_EnvConfig);
    v_Berkeley.setDatabaseConfig(   v_DBConfig);
    v_Berkeley.setEnvironmentHome(  "/Users/hy/WSS/WorkSpace_SearchDesktop/hy.common.berkeley/db");
    v_Berkeley.setDatabaseName(     "HY");
    
    v_Berkeley.open();
    
    
    String v_Key = "ZhengWei(HY)";
    
    v_Berkeley.put(v_Key ,Date.getNowTime().getFullMilli());
    System.out.println(v_Berkeley.get(v_Key));
}
 
開發者ID:HY-ZhengWei,項目名稱:hy.common.berkeley,代碼行數:23,代碼來源:JU_Berkeley.java

示例2: 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

示例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 IntegerToSetOfIntegersBinding();
    
    sh = new IntegerSetStoreShutdown();
    sh.g = this;
    Runtime.getRuntime().addShutdownHook(sh);
  } catch (DatabaseException e) {
    e.printStackTrace();
  }

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

示例4: 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

示例5: 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

示例6: commonConfig

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
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");
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:26,代碼來源:JE_Repository.java

示例7: init

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
@Override
public void init() {

    EnvironmentConfig envConfig = new EnvironmentConfig();
    commonConfig(envConfig);
    envConfig.setCachePercent(config.getCachePercent());
    envConfig.setAllowCreate(true);
    if (config.isTransactional()) {
        envConfig.setCachePercent(config.getCachePercent());
        envConfig.setTransactional(config.isTransactional());
        envConfig.setTxnTimeout(config.getTxnTimeout(), TimeUnit.SECONDS);
        this.durability = config.isCommitSync() ? Durability.COMMIT_SYNC : Durability.COMMIT_NO_SYNC;
        envConfig.setDurability(this.durability);
    }
    File repo_dir = new File(config.getRepoDir());
    if (!repo_dir.exists()) {
        repo_dir.mkdirs();
    }
    this.env = new Environment(repo_dir, envConfig);
    cef = new CommandHandlerFactoryBDBImpl();
    cursorFactoryBDBImp = new CursorFactoryBDBImp();

}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:24,代碼來源:JE_Repository.java

示例8: WebGraph

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
/**
 * 構造函數
 */
public WebGraph(String dbDir) throws DatabaseException {
  File envDir = new File(dbDir);
  EnvironmentConfig envConfig = new EnvironmentConfig();
  envConfig.setTransactional(false);
  envConfig.setAllowCreate(true);
  Environment env = new Environment(envDir, envConfig);

  StoreConfig storeConfig = new StoreConfig();
  storeConfig.setAllowCreate(true);
  storeConfig.setTransactional(false);

  store = new EntityStore(env, "classDb", storeConfig);
  outLinkIndex = store.getPrimaryIndex(String.class, Link.class);
  inLinkIndex = store.getSecondaryIndex(outLinkIndex, String.class, "toURL");
}
 
開發者ID:classtag,項目名稱:scratch_crawler,代碼行數:19,代碼來源:WebGraph.java

示例9: AbstractFrontier

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
public AbstractFrontier(String homeDirectory) {
  EnvironmentConfig envConfig = new EnvironmentConfig();
  envConfig.setTransactional(true);
  envConfig.setAllowCreate(true);
  env = new Environment(new File(homeDirectory), envConfig);
  // 設置databaseconfig
  DatabaseConfig dbConfig = new DatabaseConfig();
  dbConfig.setTransactional(true);
  dbConfig.setAllowCreate(true);
  // 打開
  catalogdatabase = env.openDatabase(null, CLASS_CATALOG, dbConfig);
  javaCatalog = new StoredClassCatalog(catalogdatabase);
  // 設置databaseconfig
  DatabaseConfig dbConfig0 = new DatabaseConfig();
  dbConfig0.setTransactional(true);
  dbConfig0.setAllowCreate(true);
  database = env.openDatabase(null, "URL", dbConfig0);
}
 
開發者ID:classtag,項目名稱:scratch_crawler,代碼行數:19,代碼來源:AbstractFrontier.java

示例10: resetDefaults

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
private void resetDefaults(boolean readOnly)
{
	envConfig.setReadOnly(readOnly);
	dbConfig.setReadOnly(readOnly);

	envConfig.setAllowCreate(!readOnly);
	dbConfig.setAllowCreate(!readOnly);

	// envConfig.setCacheSize(DEFAULT_STORE_CACHE);
	envConfig.setCachePercent(30);

	envConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX,
			Long.toString(10000000 * 10l));
	envConfig.setConfigParam(
			EnvironmentConfig.CLEANER_LOOK_AHEAD_CACHE_SIZE,
			Long.toString(1024 * 1024));
	envConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE,
			Long.toString(1024 * 1024));
}
 
開發者ID:hypergraphdb,項目名稱:hypergraphdb,代碼行數:20,代碼來源:BJEConfig.java

示例11: open

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
@Override
public void open() {
	try {
		EnvironmentConfig envConfig = new EnvironmentConfig();
		envConfig.setAllowCreate(true);
		envConfig.setCachePercent(90);

		File file = new File(databaseDir_);
		if (!file.exists()) {
			file.mkdirs();
		}
		env_ = new Environment(file, envConfig);
		DatabaseConfig dbConfig = new DatabaseConfig();
		dbConfig.setAllowCreate(true);
		bdb_ = env_
				.openDatabase(null, BdbBenchmark.DATABASE_NAME, dbConfig);
	} catch (DatabaseException e) {
		e.printStackTrace();
	}
}
 
開發者ID:ppdai,項目名稱:sessdb,代碼行數:21,代碼來源:BdbBenchmark.java

示例12: getConnection

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
private JEConnection getConnection(String envDir) {
try {
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setTransactional(true); 
    envConfig.setAllowCreate(true);    
    InitialContext iniCtx = new InitialContext();
    Context enc = (Context) iniCtx.lookup("java:comp/env");
    Object ref = enc.lookup("ra/JEConnectionFactory");
    JEConnectionFactory dcf = (JEConnectionFactory) ref;
    JEConnection dc = dcf.getConnection(envDir, envConfig);
    return dc;
} catch(Exception e) {
    System.err.println("Failure in getConnection " + e);
}
return null;
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:17,代碼來源:SimpleBean.java

示例13: openEnvAndDb

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
private void openEnvAndDb()
       throws DatabaseException {

       /* 
        * Make an environment with small nodes and no daemons.
        */
       EnvironmentConfig envConfig = TestUtils.initEnvConfig();
DbInternal.disableParameterValidation(envConfig);
       envConfig.setAllowCreate(true);
       envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "4");
       envConfig.setConfigParam("je.env.runEvictor", "false");
       envConfig.setConfigParam("je.env.runCheckpointer", "false");
       envConfig.setConfigParam("je.env.runCleaner", "false");
       envConfig.setConfigParam("je.env.runINCompressor", "false");
       envConfig.setConfigParam
           (EnvironmentParams.CLEANER_MIN_UTILIZATION.getName(), "90");
       envConfig.setConfigParam(EnvironmentParams.LOG_FILE_MAX.getName(),
                 Integer.toString(20000));

       env = new Environment(envHome, envConfig);

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

示例14: setup

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
/**
 * Setup a Berkeley DB engine environment, and preload some example records.
 *
 * @throws com.sleepycat.je.DatabaseException
 */
public void setup()
    throws DatabaseException {

    /* Open a transactional Berkeley DB engine environment. */
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    env = new Environment(new File(envDir), envConfig);

    /* Open a transactional entity store. */
    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    storeConfig.setTransactional(true);
    store = new EntityStore(env, "SQLAppStore", storeConfig);

    /* Initialize the data access object. */
    dao = new DataAccessor(store);

    /* Preload some example records. */
    loadDepartmentDb();
    loadEmployeeDb();
}
 
開發者ID:prat0318,項目名稱:dbms,代碼行數:28,代碼來源:SQLApp.java

示例15: reset

import com.sleepycat.je.EnvironmentConfig; //導入依賴的package包/類
/**
 * Replaces the existing group with the new group having a single new node
 * as described by the constructor arguments.
 *
 * @see DbResetRepGroup
 */
 public void reset() {

    Durability durability =
        new Durability(Durability.SyncPolicy.SYNC,
                       Durability.SyncPolicy.SYNC,
                       Durability.ReplicaAckPolicy.NONE);

    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setDurability(durability);

    ReplicationConfig repConfig =
        new ReplicationConfig(groupName, nodeName, nodeHostPort);
    repConfig.setHelperHosts(repConfig.getNodeHostPort());

    /* Force the re-initialization upon open. */
    repConfig.setConfigParam(RepParams.RESET_REP_GROUP.getName(), "true");

    /* Open the environment, thus replacing the group. */
    ReplicatedEnvironment repEnv =
        new ReplicatedEnvironment(envHome, repConfig, envConfig);

    repEnv.close();
}
 
開發者ID:prat0318,項目名稱:dbms,代碼行數:32,代碼來源:DbResetRepGroup.java


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