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


Java EnvironmentConfig.setSharedCache方法代碼示例

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


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

示例1: BerkeleyDbTileStore

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public BerkeleyDbTileStore() throws TileStoreException {
	super();
	acquireTileStoreLock();
	tileDbMap = new TreeMap<String, TileDatabase>();

	envConfig = new EnvironmentConfig();
	envConfig.setTransactional(false);
	envConfig.setLocking(true);
	envConfig.setExceptionListener(GUIExceptionHandler.getInstance());
	envConfig.setAllowCreate(true);
	envConfig.setSharedCache(true);
	envConfig.setCachePercent(50);

	mutations = new Mutations();

	String oldPackage1 = "tac.tilestore.berkeleydb";
	String oldPackage2 = "tac.program.tilestore.berkeleydb";
	String entry = ".TileDbEntry";
	String key = ".TileDbEntry$TileDbKey";
	mutations.addRenamer(new Renamer(oldPackage1 + entry, 0, TileDbEntry.class.getName()));
	mutations.addRenamer(new Renamer(oldPackage1 + key, 0, TileDbKey.class.getName()));
	mutations.addRenamer(new Renamer(oldPackage1 + entry, 1, TileDbEntry.class.getName()));
	mutations.addRenamer(new Renamer(oldPackage1 + key, 1, TileDbKey.class.getName()));
	mutations.addRenamer(new Renamer(oldPackage2 + entry, 2, TileDbEntry.class.getName()));
	mutations.addRenamer(new Renamer(oldPackage2 + key, 2, TileDbKey.class.getName()));

	// for (Renamer r : mutations.getRenamers())
	// log.debug(r.toString());
	Runtime.getRuntime().addShutdownHook(new ShutdownThread(true));
}
 
開發者ID:bh4017,項目名稱:mobac,代碼行數:31,代碼來源:BerkeleyDbTileStore.java

示例2: SorcerDatabase

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * Open all storage containers, indices, and catalogs.
 */
public SorcerDatabase(String homeDirectory)
    throws DatabaseException {
    // Open the Berkeley DB environment in transactional mode.
    //System.out.println("Opening environment in: " + homeDirectory);
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setLockTimeout(LOCK_TIMEOUT, TimeUnit.MILLISECONDS);
    envConfig.setTransactional(true);
    envConfig.setAllowCreate(true);
    envConfig.setSharedCache(true);
    env = new Environment(new File(homeDirectory), envConfig);

    // Set the Berkeley DB config for opening all stores.
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setTransactional(true);
    dbConfig.setAllowCreate(true);

    // Create the Serial class catalog.  This holds the serialized class
    // format for all database records of serial format.
    //
    Database catalogDb = env.openDatabase(null, CLASS_CATALOG, dbConfig);
    javaCatalog = new StoredClassCatalog(catalogDb);

    // Open the Berkeley DB database, the stores are opened
    // with no duplicate keys allowed.

    runtimeDb = env.openDatabase(null, RUNTIME_STORE, dbConfig);

    exertionDb = env.openDatabase(null, EXERTION_STORE, dbConfig);

    contextDb = env.openDatabase(null, CONTEXT_STORE, dbConfig);

    tableDb = env.openDatabase(null, TABLE_STORE, dbConfig);

    varDb = env.openDatabase(null, VAR_STORE, dbConfig);

    varModelDb = env.openDatabase(null, VAR_MODEL_STORE, dbConfig);
    
    uuidObjectDb = env.openDatabase(null, OBJECT_STORE, dbConfig);

    // Open the SecondaryDatabase for the name index of the provider in the runtime store.
    // Duplicate keys are allowed since more than one provider may be in
    // the same exertion.  A foreign key constraint is defined for the
    // name indices to ensure that a runtime only refers to
    // existing provider keys.  The CASCADE delete action means
    // that shipments will be deleted if their associated part or supplier
    // is deleted.
    //
    SecondaryConfig secConfig = new SecondaryConfig();
    secConfig.setTransactional(true);
    secConfig.setAllowCreate(true);
    secConfig.setSortedDuplicates(true);

    secConfig.setKeyCreator(new RuntimeByProviderNameKeyCreator(javaCatalog,
    		ProviderRuntime.class));
    runtimeByProviderNameDb = env.openSecondaryDatabase(null, RUNTIME_PROVIDER_NAME_INDEX,
                                                 runtimeDb, secConfig);
    secConfig.setForeignKeyDatabase(runtimeDb);
    secConfig.setForeignKeyDeleteAction(ForeignKeyDeleteAction.CASCADE);
    secConfig.setKeyCreator(new ExertionByRuntimeKeyCreator(javaCatalog,
                                                         ServiceExertion.class));
}
 
開發者ID:mwsobol,項目名稱:SORCER,代碼行數:65,代碼來源:SorcerDatabase.java


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