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


Java EnvironmentConfig.setLocking方法代碼示例

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


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

示例1: initEngine

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public boolean initEngine(File envHome)
{
 EnvironmentConfig envConfig = new EnvironmentConfig();
 m_DbConfig = new DatabaseConfig();
	
 // If the environment is read-only, then
 // make the databases read-only too.
 envConfig.setReadOnly(false);
 m_DbConfig.setReadOnly(false);
	
 // If the environment is opened for write, then we want to be 
 // able to create the environment and databases if 
 // they do not exist.
 envConfig.setAllowCreate(true);
 m_DbConfig.setAllowCreate(true);
	
 // Allow transactions if we are writing to the database
 envConfig.setTransactional(false);
 m_DbConfig.setTransactional(false);
 
 m_DbConfig.setDeferredWrite(true);
 
 envConfig.setLocking(false);	// No locking

 m_DbConfig.setBtreeComparator(BtreeKeyComparator.class);
	
 // Open the environment
 try
 {
 	m_env = new Environment(envHome, envConfig);
 	return true;
 }
 catch(DatabaseException e)
 {
 	return false;
 }
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:38,代碼來源:BTreeEnv.java

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

示例3: CrawlController

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public CrawlController(CrawlConfig config, PageFetcher pageFetcher, RobotstxtServer robotstxtServer)
		throws Exception {
	super(config);

	config.validate();
	File folder = new File(config.getCrawlStorageFolder());
	if (!folder.exists()) {
		if (!folder.mkdirs()) {
			throw new Exception("Couldn't create this folder: " + folder.getAbsolutePath());
		}
	}

	boolean resumable = config.isResumableCrawling();

	EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setAllowCreate(true);
	envConfig.setTransactional(resumable);
	envConfig.setLocking(resumable);

	File envHome = new File(config.getCrawlStorageFolder() + "/frontier");
	if (!envHome.exists()) {
		if (!envHome.mkdir()) {
			throw new Exception("Couldn't create this folder: " + envHome.getAbsolutePath());
		}
	}
	if (!resumable) {
		IO.deleteFolderContents(envHome);
	}

	env = new Environment(envHome, envConfig);
	docIdServer = new DocIDServer(env, config);
	frontier = new Frontier(env, config, docIdServer);

	this.pageFetcher = pageFetcher;
	this.robotstxtServer = robotstxtServer;

	finished = false;
	shuttingDown = false;
}
 
開發者ID:Chaiavi,項目名稱:Crawler4j,代碼行數:40,代碼來源:CrawlController.java

示例4: CrawlController

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public CrawlController(String storageFolder, boolean resumable) throws Exception {
	File folder = new File(storageFolder);
	if (!folder.exists()) {
		folder.mkdirs();
	}

	EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setAllowCreate(true);
	envConfig.setTransactional(resumable);
	envConfig.setLocking(resumable);
               
	File envHome = new File(storageFolder + File.separator + "frontier");
	if (!envHome.exists()) {
		envHome.mkdir();
	}
               
	if (!resumable) {                        
		IO.deleteFolderContents(envHome);                        
	}

	env = new Environment(envHome, envConfig);
               //Frontier.init(env, resumable);
               //DocIDServer(env, resumable);
               frontier = new Frontier(env, resumable, null);          
	docIDServer = new DocIDServer(env, resumable);                
               frontier.setDocIDServer(docIDServer);
               
	//PageFetcher.startConnectionMonitorThread();
               seeds = new ArrayList<String>();
}
 
開發者ID:eduardoguzman,項目名稱:sisob-data-extractor,代碼行數:31,代碼來源:CrawlController.java

示例5: CrawlController

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public CrawlController(CrawlConfig config, PageFetcher pageFetcher, RobotsTxtServer robotstxtServer)
        throws Exception {
    super(config);

    config.validate();
    File folder = new File(config.crawlStorageFolder());
    if (!folder.exists()) {
        if (!folder.mkdirs()) {
            throw new Exception("Couldn't create this folder: " + folder.getAbsolutePath());
        }
    }

    boolean resumable = config.resumableCrawling();

    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(resumable);
    envConfig.setLocking(resumable);

    File envHome = new File(config.crawlStorageFolder() + "/frontier");
    if (!envHome.exists()) {
        if (!envHome.mkdir()) {
            throw new Exception("Couldn't create this folder: " + envHome.getAbsolutePath());
        }
    }


    Environment env = new Environment(envHome, envConfig);

    if (!resumable) {
        List<String> names = env.getDatabaseNames();
        for (String name : names) {
            long count = env.truncateDatabase(null, name, true);
            logger.info(count + " items deleted from database " + name);
        }
        //env.removeDatabase(null, "DocIDs");
        //IO.deleteFolderContents(envHome);
    }

    docIdServer = new DocIDServer(env, config);
    frontier = new Frontier(env, config, docIdServer);

    this.pageFetcher = pageFetcher;
    this.robotstxtServer = robotstxtServer;

    finished = false;
    shuttingDown = false;
}
 
開發者ID:sapienapps,項目名稱:scrawler,代碼行數:49,代碼來源:CrawlController.java


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