• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Atomic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: saveReferenceNetwork

import org.mapdb.Atomic; //导入依赖的package包/类
public void saveReferenceNetwork(Network network) throws IOException {
    Objects.requireNonNull(network);
    if (!config.getMapDb().isPersistent()) {
        this.referenceNetwork = network;
    } else if (this.referenceNetwork == null || !this.referenceNetwork.getId().equals(network.getId())) {
        DataSource dataSource = new FileDataSource(storeDir, network.getId());
        Properties parameters = new Properties();
        parameters.setProperty("iidm.export.xml.indent", "true");
        Exporters.export("XIIDM", network, parameters, dataSource);
        Atomic.String reference = db.atomicString("referenceNetwotk").createOrOpen();
        String oldNet = reference.get();
        reference.set(network.getId() + ".xiidm");
        this.referenceNetwork = network;
        if (oldNet != null) {
            Files.delete(Paths.get(storeDir.toString(), oldNet));
        }
    }
}
 
开发者ID:itesla,项目名称:ipst,代码行数:19,代码来源:HistoDataSource.java


示例2: loadDataFromFile

import org.mapdb.Atomic; //导入依赖的package包/类
/**
 * Reads all Metadata internal datastructure from file to the instance of this class
 */
public void loadDataFromFile() {

	AptaLogger.log(Level.CONFIG, this.getClass(), "Reading metadata file from '" + this.metadataPath.toFile());
	
	// Open a connection to disk
	DB db = DBMaker
	        .fileDB(this.metadataPath.toFile())
	        .readOnly()
	        .fileMmapEnableIfSupported()
	        .closeOnJvmShutdown()
	        .make();
	
	// Load all class members from db
	Atomic.Var<Object> variable;
	
	variable = db.atomicVar("qualityScoresForward").createOrOpen();
	qualityScoresForward = (HashMap<String, ConcurrentHashMap<Integer, Accumulator>>) variable.get();

	variable = db.atomicVar("qualityScoresReverse").createOrOpen();
	qualityScoresReverse = (HashMap<String, ConcurrentHashMap<Integer, Accumulator>>) variable.get();
	
	variable = db.atomicVar("nucleotideDistributionForward").createOrOpen();
	nucleotideDistributionForward = (HashMap<String, ConcurrentHashMap<Integer, ConcurrentHashMap<Byte, Integer>>>) variable.get();
	
	variable = db.atomicVar("nucleotideDistributionReverse").createOrOpen();
	nucleotideDistributionReverse = (HashMap<String, ConcurrentHashMap<Integer, ConcurrentHashMap<Byte, Integer>>>) variable.get();

	variable = db.atomicVar("nucleotideDistributionAccepted").createOrOpen();
	nucleotideDistributionAccepted = (HashMap<String, ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, ConcurrentHashMap<Byte, Integer>>>>) variable.get();
	
	variable = db.atomicVar("parserStatistics").createOrOpen();
	parserStatistics = (HashMap<String, Integer>) variable.get();
	
	// Close database connection
       db.close();
	
}
 
开发者ID:drivenbyentropy,项目名称:aptasuite,代码行数:41,代码来源:Metadata.java


示例3: saveDataToFile

import org.mapdb.Atomic; //导入依赖的package包/类
/**
 * Takes the current state of all class members of Metadata and dumps them on disk
 */
public void saveDataToFile() {
	
	// Open a connection to disk
	DB db = DBMaker
	        .fileDB(this.metadataPath.toFile())
	        .fileMmapEnableIfSupported()
	        .closeOnJvmShutdown()
	        .make();
	
	// Load all class members from db
	Atomic.Var<Object> variable;
	
	variable = db.atomicVar("qualityScoresForward").createOrOpen();
	variable.set(qualityScoresForward);

	variable = db.atomicVar("qualityScoresReverse").createOrOpen();
	variable.set(qualityScoresReverse);
	
	variable = db.atomicVar("nucleotideDistributionForward").createOrOpen();
	variable.set(nucleotideDistributionForward);
	
	variable = db.atomicVar("nucleotideDistributionReverse").createOrOpen();
	variable.set(nucleotideDistributionReverse);

	variable = db.atomicVar("nucleotideDistributionAccepted").createOrOpen();
	variable.set(nucleotideDistributionAccepted);
	
	variable = db.atomicVar("parserStatistics").createOrOpen();
	variable.set(parserStatistics);
	
	// Close database connection
       db.close();
	
       AptaLogger.log(Level.CONFIG, this.getClass(), "Saved metadata to file '" + this.metadataPath.toFile());
       
}
 
开发者ID:drivenbyentropy,项目名称:aptasuite,代码行数:40,代码来源:Metadata.java


示例4: createPrefixedURI

import org.mapdb.Atomic; //导入依赖的package包/类
public static String createPrefixedURI(final String fullURI, final Map<String, String> uriPrefixedURIMap,
		final Map<String, String> tempNamespacePrefixes, final Map<String, String> inMemoryNamespacePrefixes,
		final Tuple<Atomic.Long, DB> prefixCounterTuple, final GraphDatabaseService database,
		final TransactionHandler tx)
		throws DMPGraphException {

	if (fullURI == null) {

		throw new DMPGraphException("full URI shouldn't be null");
	}

	if (uriPrefixedURIMap != null) {

		if (!uriPrefixedURIMap.containsKey(fullURI)) {

			final String prefixedURI = determinePrefixedURI(fullURI, tempNamespacePrefixes, inMemoryNamespacePrefixes, prefixCounterTuple,
					database, tx);

			uriPrefixedURIMap.put(fullURI, prefixedURI);
		}

		return uriPrefixedURIMap.get(fullURI);
	} else {

		return determinePrefixedURI(fullURI, tempNamespacePrefixes, inMemoryNamespacePrefixes, prefixCounterTuple, database, tx);
	}
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:28,代码来源:NamespaceUtils.java


示例5: determinePrefixedURI

import org.mapdb.Atomic; //导入依赖的package包/类
public static String determinePrefixedURI(final String fullURI, final Map<String, String> tempNamespacePrefixes,
		final Map<String, String> inMemoryNamespacePrefixes, final Tuple<Atomic.Long, DB> prefixCounterTuple, final GraphDatabaseService database,
		final TransactionHandler tx)
		throws DMPGraphException {

	final Tuple<String, String> uriParts = URI.determineParts(fullURI);
	final String namespaceURI = uriParts.v1();
	final String localName = uriParts.v2();

	final String prefix = NamespaceUtils
			.getPrefix(namespaceURI, tempNamespacePrefixes, inMemoryNamespacePrefixes, prefixCounterTuple, database, tx);

	return prefix + NamespaceUtils.PREFIX_DELIMITER + localName;
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:15,代码来源:NamespaceUtils.java


示例6: createOrGetLongIndex

import org.mapdb.Atomic; //导入依赖的package包/类
public static Atomic.Long createOrGetLongIndex(final DB db, final String indexName, final long initValue) {

		final Atomic.Long longIndex;

		if (db.getCatalog().containsKey(indexName)) {

			final Atomic.Long atomicLong = db.getAtomicLong(indexName);
			atomicLong.getAndSet(initValue);

			longIndex = atomicLong;

			db.commit();
		} else {

			longIndex = db.createAtomicLong(indexName, initValue);
		}

		return longIndex;
	}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:20,代码来源:MapDBUtils.java


示例7: getNewPrefixCount

import org.mapdb.Atomic; //导入依赖的package包/类
private static long getNewPrefixCount(final Tuple<Atomic.Long, DB> prefixCounterTuple) {

		final Atomic.Long prefixCounter = prefixCounterTuple.v1();
		final DB prefixCounterDB = prefixCounterTuple.v2();

		final long prefixCount = prefixCounter.getAndIncrement();

		prefixCounterDB.commit();

		return prefixCount;
	}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:12,代码来源:NamespaceUtils.java


示例8: createOrGetPersistentLongIndexGlobalTransactional

import org.mapdb.Atomic; //导入依赖的package包/类
public static Tuple<Atomic.Long, DB> createOrGetPersistentLongIndexGlobalTransactional(final String indexFileName, final String indexName,
		final long initValue) {

	final DB db = createGlobalTransactionalPermanentMapDB(indexFileName);

	return Tuple.tuple(createOrGetLongIndex(db, indexName, initValue), db);
}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:8,代码来源:MapDBUtils.java


示例9: createLongIndex

import org.mapdb.Atomic; //导入依赖的package包/类
public static Atomic.Long createLongIndex(final DB db, final String indexName) {

		return db.getAtomicLong(indexName);
	}
 
开发者ID:dswarm,项目名称:dswarm-graph-neo4j,代码行数:5,代码来源:MapDBUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TerminalSize类代码示例发布时间:2022-05-22
下一篇:
Java KMeansDriver类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap