当前位置: 首页>>代码示例>>Java>>正文


Java EnvironmentLockedException类代码示例

本文整理汇总了Java中com.sleepycat.je.EnvironmentLockedException的典型用法代码示例。如果您正苦于以下问题:Java EnvironmentLockedException类的具体用法?Java EnvironmentLockedException怎么用?Java EnvironmentLockedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EnvironmentLockedException类属于com.sleepycat.je包,在下文中一共展示了EnvironmentLockedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public void init() throws EnvironmentLockedException, DatabaseException {
	EnvironmentConfig environmentConfig = new EnvironmentConfig();
	DatabaseConfig dbConfig = new DatabaseConfig();
	dbConfig.setAllowCreate(true);
	dbConfig.setSortedDuplicates(true);
	environmentConfig.setReadOnly(false);
	environmentConfig.setAllowCreate(true);
	// Open the environment and entity store
	if (!dataDir.exists()) {
		dataDir.mkdirs();
	}
	environment = new Environment(dataDir, environmentConfig);
	// Database database = environment.openDatabase(transaction, "BDB", dbConfig);
	this.bdb = new BdbDatabaseImpl(environment, "DEFAULT");
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:16,代码来源:BdbImpl.java

示例2: TileDatabase

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public TileDatabase(String mapSourceName, File databaseDirectory) throws IOException,
		EnvironmentLockedException, DatabaseException {
	log.debug("Opening tile store db: \"" + databaseDirectory + "\"");
	File storeDir = databaseDirectory;
	DelayedInterruptThread t = (DelayedInterruptThread) Thread.currentThread();
	try {
		t.pauseInterrupt();
		this.mapSourceName = mapSourceName;
		lastAccess = System.currentTimeMillis();

		Utilities.mkDirs(storeDir);

		env = new Environment(storeDir, envConfig);

		StoreConfig storeConfig = new StoreConfig();
		storeConfig.setAllowCreate(true);
		storeConfig.setTransactional(false);
		storeConfig.setMutations(mutations);
		store = new EntityStore(env, "TilesEntityStore", storeConfig);

		tileIndex = store.getPrimaryIndex(TileDbKey.class, TileDbEntry.class);
	} finally {
		if (t.interruptedWhilePaused())
			close();
		t.resumeInterrupt();
	}
}
 
开发者ID:bh4017,项目名称:mobac,代码行数:28,代码来源:BerkeleyDbTileStore.java

示例3: EnvironmentImpl

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public EnvironmentImpl(File envHome,
                       EnvironmentConfig envConfig,
                       EnvironmentImpl sharedCacheEnv)
    throws EnvironmentNotFoundException, EnvironmentLockedException {

    this(envHome, envConfig, sharedCacheEnv, null);
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:8,代码来源:EnvironmentImpl.java

示例4: InternalEnvironment

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public InternalEnvironment(File envHome,
                           EnvironmentConfig configuration,
                           EnvironmentImpl envImpl)
    throws EnvironmentNotFoundException,
           EnvironmentLockedException,
           VersionMismatchException,
           DatabaseException,
           IllegalArgumentException {
    super(envHome, configuration, false /*openIfNeeded*/,
          null /*repConfigProxy*/, envImpl);
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:12,代码来源:EnvironmentImpl.java

示例5: RepImpl

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public RepImpl(File envHome,
               EnvironmentConfig envConfig,
               EnvironmentImpl sharedCacheEnv,
               RepConfigProxy repConfigProxy)
    throws EnvironmentNotFoundException, EnvironmentLockedException {

    super(envHome, envConfig, sharedCacheEnv, repConfigProxy);

    allowConvert =
        RepInternal.getAllowConvert(((ReplicationConfig) repConfigProxy));
    feederTxns = new FeederTxns(this);
    replay = new Replay(this, nameIdPair);
    nodeState = new NodeState(nameIdPair, this);
    repConfigObservers = new ArrayList<RepEnvConfigObserver>();
    addRepConfigObserver(this);

    nodeStats = new StatGroup(RepImplStatDefinition.GROUP_NAME,
                              RepImplStatDefinition.GROUP_DESC);
    hardRecoveryStat = new BooleanStat(nodeStats,
                                       RepImplStatDefinition.HARD_RECOVERY);
    hardRecoveryInfoStat =
        new StringStat(nodeStats, RepImplStatDefinition.HARD_RECOVERY_INFO,
                       "This node did not incur a hard recovery.");

    syncupProgressListener =
        ((ReplicationConfig)repConfigProxy).getSyncupProgressListener();
    logRewriteListener =
        ((ReplicationConfig)repConfigProxy).getLogFileRewriteListener();
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:30,代码来源:RepImpl.java

示例6: listDbs

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
private void listDbs()
    throws EnvironmentNotFoundException, EnvironmentLockedException {

    openEnv(true);

    List<String> dbNames = env.getDatabaseNames();
    Iterator<String> iter = dbNames.iterator();
    while (iter.hasNext()) {
        String name = iter.next();
        System.out.println(name);
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:13,代码来源:DbDump.java

示例7: makeUtilityEnvironment

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
/**
 * Create an environment suitable for utilities. Utilities should in
 * general send trace output to the console and not to the db log.
 */
public static EnvironmentImpl makeUtilityEnvironment(File envHome,
                                                     boolean readOnly)
    throws EnvironmentNotFoundException, EnvironmentLockedException {

    EnvironmentConfig config = new EnvironmentConfig();
    config.setReadOnly(readOnly);

    /* Don't debug log to the database log. */
    config.setConfigParam(EnvironmentParams.JE_LOGGING_DBLOG.getName(),
                          "false");

    /* Don't run recovery. */
    config.setConfigParam(EnvironmentParams.ENV_RECOVERY.getName(),
                          "false");

    /* Apply the configuration in the je.properties file. */
    DbConfigManager.applyFileConfig
        (envHome, DbInternal.getProps(config), false);

    EnvironmentImpl envImpl =
        new EnvironmentImpl(envHome,
                            config,
                            null);
    envImpl.finishInit(config);

    return envImpl;
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:32,代码来源:CmdUtil.java

示例8: initEnvironment

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
protected Environment initEnvironment() throws EnvironmentLockedException, DatabaseException {
	EnvironmentConfig envConfig = new EnvironmentConfig();
	envConfig.setAllowCreate(true);
	envConfig.setTransactional(true);
	envConfig.setSharedCache(true);
	envConfig.setCacheSize(sharedCacheSize);
	
	return new Environment(envDir, envConfig);
}
 
开发者ID:mosscode,项目名称:bdbwrap,代码行数:10,代码来源:EnvironmentWrap.java

示例9: Wikipedia

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public Wikipedia(Conf conf) throws
		EnvironmentLockedException {
	this.env = new WEnvironment(conf) ;
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:5,代码来源:Wikipedia.java

示例10: ReplicatedEnvironment

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
/**
 * For internal use only.
 * @hidden
 *
 * Note that repImpl.joinGroup is a synchronized
 * method, and therefore protected against multiple concurrent attempts to
 * create a handle.
 *
 * @param envImpl is non-null only when used by EnvironmentIml to create an
 * InternalEnvironment.
 */
protected ReplicatedEnvironment(File envHome,
                                ReplicationConfig repConfig,
                                EnvironmentConfig envConfig,
                                ReplicaConsistencyPolicy consistencyPolicy,
                                QuorumPolicy initialElectionPolicy,
                                boolean joinGroup,
                                RepImpl envImplParam)
    throws EnvironmentNotFoundException,
           EnvironmentLockedException,
           ReplicaConsistencyException {

    super(envHome, envConfig, repConfig, envImplParam);

    repImpl = (RepImpl) envImpl;
    nameIdPair = repImpl.getNameIdPair();
    if (joinGroup) {
        try {
            joinGroup(consistencyPolicy, initialElectionPolicy);
        } catch (RollbackException e) {

            /*
             * Syncup failed, a hard recovery is needed. Throwing the
             * RollbackException closed the RepImpl and the EnvironmentImpl
             * Redo the creation of RepImpl and retry the join once. If the
             * second joinGroup fails, let the exception throw out to the
             * user.
             */
            envImpl = makeEnvironmentImpl(envHome, envConfig,
                                          true /*createIfNeeded*/,
                                          repConfig);
            repImpl = (RepImpl) envImpl;
            joinGroup(consistencyPolicy, initialElectionPolicy);
            repImpl.setHardRecoveryInfo(e);
        }

        /*
         * Fire a JoinGroupEvent only when the ReplicatedEnvironment is
         * successfully created for the first time.
         */
        if (repImpl.getRepNode() != null) {
            repImpl.getRepNode().
                getMonitorEventManager().notifyJoinGroup();
        }
    } else {
        /* For testing only */
        if (repImpl.getRepNode() != null) {
            throw EnvironmentFailureException.unexpectedState
                ("An earlier handle creation had resulted in the node" +
                 "joining the group");
        }
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:64,代码来源:ReplicatedEnvironment.java

示例11: dump

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
/**
 * Start the scavenger run.
 */
@Override
public void dump()
    throws EnvironmentNotFoundException,
           EnvironmentLockedException,
           IOException {

    openEnv(false);

    envImpl = DbInternal.getEnvironmentImpl(env);
    DbConfigManager cm = envImpl.getConfigManager();
    readBufferSize = cm.getInt(EnvironmentParams.LOG_ITERATOR_READ_SIZE);

    /*
     * Find the end of the log.
     */
    LastFileReader reader = new LastFileReader(envImpl, readBufferSize);
    while (reader.readNextEntry()) {
    }

    /* Tell the fileManager where the end of the log is. */
    long lastUsedLsn = reader.getLastValidLsn();
    long nextAvailableLsn = reader.getEndOfLog();
    envImpl.getFileManager().setLastPosition(nextAvailableLsn,
                                             lastUsedLsn,
                                             reader.getPrevOffset());

    try {
        /* Pass 1: Scavenge the dbtree. */
        if (verbose) {
            System.out.println("Pass 1: " + new Date());
        }
        scavengeDbTree(lastUsedLsn, nextAvailableLsn);

        /* Pass 2: Scavenge the databases. */
        if (verbose) {
            System.out.println("Pass 2: " + new Date());
        }
        scavenge(lastUsedLsn, nextAvailableLsn);

        if (verbose) {
            System.out.println("End: " + new Date());
        }
    } finally {
        closeOutputStreams();
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:50,代码来源:DbScavenger.java

示例12: dump

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
/**
 * Perform the dump.
 *
 * @throws EnvironmentFailureException if an unexpected, internal or
 * environment-wide failure occurs.
 *
 * @throws IOException in subclasses.
 */
public void dump()
    throws EnvironmentNotFoundException,
           EnvironmentLockedException,
           DatabaseNotFoundException,
           IOException {

    openEnv(true);

    LoggerUtils.envLogMsg(Level.INFO, DbInternal.getEnvironmentImpl(env),
                          "DbDump.dump of " + dbName + " starting");

    DatabaseEntry foundKey = new DatabaseEntry();
    DatabaseEntry foundData = new DatabaseEntry();

    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setReadOnly(true);
    DbInternal.setUseExistingConfig(dbConfig, true);
    Database db;
    try {
        db = env.openDatabase(null, dbName, dbConfig);
    } catch (DatabaseExistsException e) {
        /* Should never happen, ExclusiveCreate is false. */
        throw EnvironmentFailureException.unexpectedException(e);
    }
    dupSort = db.getConfig().getSortedDuplicates();

    printHeader(outputFile, dupSort, formatUsingPrintable);

    Cursor cursor = db.openCursor(null, null);
    while (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) ==
           OperationStatus.SUCCESS) {
        dumpOne(outputFile, foundKey.getData(), formatUsingPrintable);
        dumpOne(outputFile, foundData.getData(), formatUsingPrintable);
    }
    cursor.close();
    db.close();
    outputFile.println("DATA=END");

    LoggerUtils.envLogMsg(Level.INFO, DbInternal.getEnvironmentImpl(env),
                          "DbDump.dump of " + dbName + " ending");
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:50,代码来源:DbDump.java

示例13: main

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public static void main(String[] args) throws EnvironmentLockedException, DatabaseException, IOException {
	
	if (args.length != 1) {		
		System.out.println("Please specify a directory containing a fully prepared Wikipedia database") ;
		return ;
	}
	
	File envDir = new File(args[0]) ;
	
	WikipediaConfiguration conf = new WikipediaConfiguration("en", envDir) ;

	CommandLineThesaurus clt = new CommandLineThesaurus(conf) ;
	clt.start() ;
	
	
	
}
 
开发者ID:busk,项目名称:WikipediaMiner,代码行数:18,代码来源:CommandLineThesaurus.java

示例14: main

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public static void main(String args[]) throws EnvironmentLockedException, ParserConfigurationException, SAXException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
	
	File sentenceModel = new File("models/en-sent.bin") ;
	
	
	File wikiConf = new File("configs/en.xml") ;
	
	Wikipedia wiki = new Wikipedia(wikiConf, false) ;
	
	
	
	SnippetExtractor se = new SnippetExtractor(wiki, sentenceModel) ;
	
	File artTitles = new File("data/sentenceArticles.txt") ;
	Vector<Article> articles = se.gatherArticles(artTitles) ;
	
	//se.testAllArticles(articles) ;
	
	se.testSentenceExtraction(wiki.getArticleByTitle("Carnivore")) ;
	
	
	
}
 
开发者ID:busk,项目名称:WikipediaMiner,代码行数:24,代码来源:SnippetExtractor.java

示例15: CommandLineThesaurus

import com.sleepycat.je.EnvironmentLockedException; //导入依赖的package包/类
public CommandLineThesaurus(WikipediaConfiguration conf) throws EnvironmentLockedException, DatabaseException {
	
	
	
	
	wikipedia = new Wikipedia(conf, false) ;	
	input = new BufferedReader(new InputStreamReader(System.in));
	stripper = new MarkupStripper() ;
}
 
开发者ID:busk,项目名称:WikipediaMiner,代码行数:10,代码来源:CommandLineThesaurus.java


注:本文中的com.sleepycat.je.EnvironmentLockedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。