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

Java Cache类代码示例

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

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



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

示例1: getCached

import org.xbill.DNS.Cache; //导入依赖的package包/类
private Message getCached(Message query) {
	Cache cache = getCache();
	if (cache == null)
		return null;

	Record question = query.getQuestion();
	RRset[] rrsets = cache.findAnyRecords(question.getName(), question.getType());
	if (rrsets == null)
		return null;

	Message msg = new Message();
	for (RRset rrset : rrsets) {
		@SuppressWarnings("unchecked")
		Iterator<Record> recordsIter = rrset.rrs();
		while (recordsIter.hasNext()) {
			msg.addRecord(recordsIter.next(), Section.ANSWER);
		}
	}
	return msg;
}
 
开发者ID:wnagele,项目名称:dnsjava-recursive-resolver,代码行数:21,代码来源:RecursiveResolver.java


示例2: DNSCacheManager

import org.xbill.DNS.Cache; //导入依赖的package包/类
public DNSCacheManager() {
    setProperty(new CollectionProperty(SERVERS, new ArrayList<String>()));
    //disabling cache
    lookupCache = new Cache();
    lookupCache.setMaxCache(0);
    lookupCache.setMaxEntries(0);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:8,代码来源:DNSCacheManager.java


示例3: DnsServicesDiscovery

import org.xbill.DNS.Cache; //导入依赖的package包/类
/**
 * Overloaded constructor taking as argument Cache size and TTL.
 *
 * @param cacheSize Unsigned <code>int</code> defining the Cache size
 * @param cacheTTL Unsigned <code>int</code> defining the Cache TTL
 */
public DnsServicesDiscovery(int cacheSize, int cacheTTL)
{
    this.anyClassCache = new Cache(DClass.ANY);
    this.anyClassCache.setMaxEntries(cacheSize);
    this.anyClassCache.setMaxNCache(cacheTTL);
    this.helper = this.new ServicesLookupHelper();
    this.errorsTrace = new ThreadLocal<Map<String, StatusCode>>() {
        @Override
        protected Map<String, StatusCode> initialValue() {
            return new LinkedHashMap<>();
        }
    };
}
 
开发者ID:eclipse,项目名称:tiaki-java,代码行数:20,代码来源:DnsServicesDiscovery.java


示例4: doLookup

import org.xbill.DNS.Cache; //导入依赖的package包/类
private Lookup doLookup(final SimpleResolver resolver, String hostname)
    throws TextParseException {
  final Cache cache = new Cache();
  final Lookup lookup = new Lookup(new Name(hostname), org.xbill.DNS.Type.SRV);
  lookup.setResolver(resolver);
  lookup.setCache(cache);
  return lookup;
}
 
开发者ID:spotify,项目名称:helios-skydns,代码行数:9,代码来源:UsingSkyDnsITCase.java


示例5: addCached

import org.xbill.DNS.Cache; //导入依赖的package包/类
private void addCached(Message msg) {
	Cache cache = getCache();
	if (cache != null)
		cache.addMessage(msg);
}
 
开发者ID:wnagele,项目名称:dnsjava-recursive-resolver,代码行数:6,代码来源:RecursiveResolver.java


示例6: init

import org.xbill.DNS.Cache; //导入依赖的package包/类
@PostConstruct
public void init() throws Exception {
    logger.debug("DNSService init...");

    // If no DNS servers were configured, default to local host
    if (dnsServers.isEmpty()) {
        try {
            dnsServers.add(InetAddress.getLocalHost().getHostName());
        } catch (UnknownHostException ue) {
            dnsServers.add("127.0.0.1");
        }
    }

    // Create the extended resolver...
    final String[] serversArray = (String[]) dnsServers.toArray(new String[0]);

    if (logger.isInfoEnabled()) {
        for (int c = 0; c < serversArray.length; c++) {
            logger.info("DNS Server is: " + serversArray[c]);
        }
    }

    try {
        resolver = new ExtendedResolver(serversArray);
    } catch (UnknownHostException uhe) {
        logger.error("DNS service could not be initialized.  The DNS servers specified are not recognized hosts.", uhe);
        throw uhe;
    }

    cache = new Cache(DClass.IN);
    cache.setMaxEntries(maxCacheSize);

    if (setAsDNSJavaDefault) {
        Lookup.setDefaultResolver(resolver);
        Lookup.setDefaultCache(cache, DClass.IN);
        Lookup.setDefaultSearchPath(searchPaths);
        logger.info("Registered cache, resolver and search paths as DNSJava defaults");
    }

    // Cache the local hostname and local address. This is needed because
    // the following issues:
    // JAMES-787
    // JAMES-302
    InetAddress addr = getLocalHost();
    localCanonicalHostName = addr.getCanonicalHostName();
    localHostName = addr.getHostName();
    localAddress = addr.getHostAddress();

    logger.debug("DNSService ...init end");
}
 
开发者ID:twachan,项目名称:James,代码行数:51,代码来源:DNSJavaService.java


示例7: setCache

import org.xbill.DNS.Cache; //导入依赖的package包/类
public void setCache(Cache c) {
    cache = c;
}
 
开发者ID:twachan,项目名称:James,代码行数:4,代码来源:DNSJavaServiceTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Repository类代码示例发布时间:2022-05-22
下一篇:
Java GroupQueryImpl类代码示例发布时间: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