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

Java Descriptor类代码示例

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

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



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

示例1: addDescriptors

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
public synchronized void addDescriptors(List<T> descriptors) {
	final List<T> journalDescriptors = new ArrayList<T>();
	int duplicateCount = 0;
	for(T d: descriptors) {
		if(data.addDescriptor(d)) {
			if(d.getCacheLocation() == Descriptor.CacheLocation.NOT_CACHED) {
				journalLength += d.getBodyLength();
				journalDescriptors.add(d);
			}
		} else {
			duplicateCount += 1;
		}
	}

	if(!journalDescriptors.isEmpty()) {
		store.appendDocumentList(journalFile, journalDescriptors);
	}
	if(duplicateCount > 0) {
		logger.info("Duplicate descriptors added to journal, count = "+ duplicateCount);
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:22,代码来源:DescriptorCache.java


示例2: loadJournalFileBuffer

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
private void loadJournalFileBuffer(ByteBuffer buffer) {
	journalLength = buffer.limit();
	if(journalLength == 0) {
		return;
	}
	final DocumentParser<T> parser = createDocumentParser(buffer);
	final DocumentParsingResult<T> result = parser.parse();
	if(result.isOkay()) {
		int duplicateCount = 0;
		logger.fine("Loaded "+ result.getParsedDocuments().size() + " descriptors from journal");
		for(T d: result.getParsedDocuments()) {
			d.setCacheLocation(Descriptor.CacheLocation.CACHED_JOURNAL);
			if(!data.addDescriptor(d)) {
				duplicateCount += 1;
			}
		} 
		if(duplicateCount > 0) {
			logger.info("Found "+ duplicateCount + " duplicate descriptors in journal file");
		}
	} else if(result.isInvalid()) {
		logger.warning("Invalid descriptor data parsing from journal file : "+ result.getMessage());
	} else if(result.isError()) {
		logger.warning("Error parsing descriptors from journal file : "+ result.getMessage());			
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:26,代码来源:DescriptorCache.java


示例3: getDescriptorForRouterStatus

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
private Descriptor getDescriptorForRouterStatus(RouterStatus rs, boolean isMicrodescriptor) {
	if(isMicrodescriptor) {
		return microdescriptorCache.getDescriptor(rs.getMicrodescriptorDigest());
	} else {
		return basicDescriptorCache.getDescriptor(rs.getDescriptorDigest());
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:DirectoryImpl.java


示例4: removeUnrequestedDescriptors

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
private <T extends Descriptor> List<T> removeUnrequestedDescriptors(Set<HexDigest> requested, List<T> received) {
	final List<T> result = new ArrayList<T>();
	int unrequestedCount = 0;
	for(T d: received) {
		if(requested.contains(d.getDescriptorDigest())) {
			result.add(d);
		} else {
			unrequestedCount += 1;
		}
	}
	if(unrequestedCount > 0) {
		logger.warning("Discarding "+ unrequestedCount + " received descriptor(s) with fingerprints that did not match requested descriptors");
	}
	return result;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:16,代码来源:DirectoryDownloaderImpl.java


示例5: loadCacheFileBuffer

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
private void loadCacheFileBuffer(ByteBuffer buffer) {
	cacheLength = buffer.limit();
	if(cacheLength == 0) {
		return;
	}
	final DocumentParser<T> parser = createDocumentParser(buffer);
	final DocumentParsingResult<T> result = parser.parse();
	if(result.isOkay()) {
		for(T d: result.getParsedDocuments()) {
			d.setCacheLocation(Descriptor.CacheLocation.CACHED_CACHEFILE);
			data.addDescriptor(d);
		}
	}

}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:16,代码来源:DescriptorCache.java


示例6: addConsensusDocument

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
public synchronized void addConsensusDocument(ConsensusDocument consensus, boolean fromCache) {
	if(consensus.equals(currentConsensus))
		return;

	if(currentConsensus != null && consensus.getValidAfterTime().isBefore(currentConsensus.getValidAfterTime())) {
		logger.warning("New consensus document is older than current consensus document");
		return;
	}

	synchronized(TrustedAuthorities.getInstance()) {
		switch(consensus.verifySignatures()) {
		case STATUS_FAILED:
			logger.warning("Unable to verify signatures on consensus document, discarding...");
			return;
			
		case STATUS_NEED_CERTS:
			consensusWaitingForCertificates = consensus;
			requiredCertificates.addAll(consensus.getRequiredCertificates());
			return;

		case STATUS_VERIFIED:
			break;
		}
		requiredCertificates.addAll(consensus.getRequiredCertificates());
	
	}
	final Map<HexDigest, RouterImpl> oldRouterByIdentity = new HashMap<HexDigest, RouterImpl>(routersByIdentity);

	clearAll();

	for(RouterStatus status: consensus.getRouterStatusEntries()) {
		if(status.hasFlag("Running") && status.hasFlag("Valid")) {
			final RouterImpl router = updateOrCreateRouter(status, oldRouterByIdentity);
			addRouter(router);
			classifyRouter(router);
		}
		final Descriptor d = getDescriptorForRouterStatus(status, consensus.getFlavor() == ConsensusFlavor.MICRODESC);
		if(d != null) {
			d.setLastListed(consensus.getValidAfterTime().getTime());
		}
	}
	
	logger.fine("Loaded "+ routersByIdentity.size() +" routers from consensus document");
	currentConsensus = consensus;
	
	if(!fromCache) {
		storeCurrentConsensus();
	}
	consensusChangedManager.fireEvent(new Event() {});
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:51,代码来源:DirectoryImpl.java


示例7: getCurrentDescriptor

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
public Descriptor getCurrentDescriptor() {
	refreshDescriptor();
	return descriptor;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:5,代码来源:RouterImpl.java


示例8: getCurrentDescriptor

import com.subgraph.orchid.Descriptor; //导入依赖的package包/类
public Descriptor getCurrentDescriptor() {
	return descriptor;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:4,代码来源:BridgeRouterImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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