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


Java JmDNSImpl类代码示例

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


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

示例1: start

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
@Override
public void start(Timer timer) {
    long now = System.currentTimeMillis();
    if (now - this.getDns().getLastThrottleIncrement() < DNSConstants.PROBE_THROTTLE_COUNT_INTERVAL) {
        this.getDns().setThrottle(this.getDns().getThrottle() + 1);
    } else {
        this.getDns().setThrottle(1);
    }
    this.getDns().setLastThrottleIncrement(now);

    if (this.getDns().isAnnounced() && this.getDns().getThrottle() < DNSConstants.PROBE_THROTTLE_COUNT) {
        timer.schedule(this, JmDNSImpl.getRandom().nextInt(1 + DNSConstants.PROBE_WAIT_INTERVAL), DNSConstants.PROBE_WAIT_INTERVAL);
    } else if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
        timer.schedule(this, DNSConstants.PROBE_CONFLICT_INTERVAL, DNSConstants.PROBE_CONFLICT_INTERVAL);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:17,代码来源:Prober.java

示例2: start

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
@Override
public void start(Timer timer)
{
    long now = System.currentTimeMillis();
    if (now - this.getDns().getLastThrottleIncrement() < DNSConstants.PROBE_THROTTLE_COUNT_INTERVAL)
    {
        this.getDns().setThrottle(this.getDns().getThrottle() + 1);
    }
    else
    {
        this.getDns().setThrottle(1);
    }
    this.getDns().setLastThrottleIncrement(now);

    if (this.getDns().isAnnounced() && this.getDns().getThrottle() < DNSConstants.PROBE_THROTTLE_COUNT)
    {
        timer.schedule(this, JmDNSImpl.getRandom().nextInt(1 + DNSConstants.PROBE_WAIT_INTERVAL), DNSConstants.PROBE_WAIT_INTERVAL);
    }
    else if (!this.getDns().isCanceling() && !this.getDns().isCanceled())
    {
        timer.schedule(this, DNSConstants.PROBE_CONFLICT_INTERVAL, DNSConstants.PROBE_CONFLICT_INTERVAL);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:24,代码来源:Prober.java

示例3: start

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
@Override
public void start(Timer timer) {
    // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding":
    // We respond immediately if we know for sure, that we are the only one who can respond to the query.
    // In all other cases, we respond within 20-120 ms.
    //
    // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression":
    // We respond after 20-120 ms if the query is truncated.

    boolean iAmTheOnlyOne = true;
    for (DNSQuestion question : _in.getQuestions()) {
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest(this.getName() + "start() question=" + question);
        }
        iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns());
        if (!iAmTheOnlyOne) {
            break;
        }
    }
    int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival();
    if (delay < 0) {
        delay = 0;
    }
    if (logger.isLoggable(Level.FINEST)) {
        logger.finest(this.getName() + "start() Responder chosen delay=" + delay);
    }
    if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
        timer.schedule(this, delay);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:31,代码来源:Responder.java

示例4: main

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public static void main(String[] argv) throws Exception{
        JmDNS jmDNS = new JmDNSImpl(InetAddress.getLocalHost(), "karl");
        jmDNS.addServiceTypeListener(new DiscoverServices.SampleListener());
        jmDNS.addServiceListener(SocketAppender.ZONE, new DiscoverServices.SampleListener());
        //String type, String name, String subtype, int port, int weight, int priority, boolean persistent, String text
//        ServiceInfo serviceInfo = new ServiceInfoImpl("log4j", "log4j-agent", "log4j", 4561, 1, 1, true, "log4j-agent-text");
//        jmDNS.registerService(serviceInfo);
//        System.out.println(jmDNS);
    }
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:10,代码来源:JmDnsUtil.java

示例5: start

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
@Override
public void start(Timer timer)
{
    // According to draft-cheshire-dnsext-multicastdns.txt chapter "7 Responding":
    // We respond immediately if we know for sure, that we are the only one who can respond to the query.
    // In all other cases, we respond within 20-120 ms.
    //
    // According to draft-cheshire-dnsext-multicastdns.txt chapter "6.2 Multi-Packet Known Answer Suppression":
    // We respond after 20-120 ms if the query is truncated.

    boolean iAmTheOnlyOne = true;
    for (DNSQuestion question : _in.getQuestions())
    {
        if (logger.isLoggable(Level.FINEST))
        {
            logger.finest(this.getName() + "start() question=" + question);
        }
        iAmTheOnlyOne = question.iAmTheOnlyOne(this.getDns());
        if (!iAmTheOnlyOne)
        {
            break;
        }
    }
    int delay = (iAmTheOnlyOne && !_in.isTruncated()) ? 0 : DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + JmDNSImpl.getRandom().nextInt(DNSConstants.RESPONSE_MAX_WAIT_INTERVAL - DNSConstants.RESPONSE_MIN_WAIT_INTERVAL + 1) - _in.elapseSinceArrival();
    if (delay < 0)
    {
        delay = 0;
    }
    if (logger.isLoggable(Level.FINEST))
    {
        logger.finest(this.getName() + "start() Responder chosen delay=" + delay);
    }
    if (!this.getDns().isCanceling() && !this.getDns().isCanceled())
    {
        timer.schedule(this, delay);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:38,代码来源:Responder.java

示例6: Announcer

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Announcer(JmDNSImpl jmDNSImpl)
{
    super(jmDNSImpl, defaultTTL());

    this.setTaskState(DNSState.ANNOUNCING_1);
    this.associate(DNSState.ANNOUNCING_1);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:Announcer.java

示例7: Canceler

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Canceler(JmDNSImpl jmDNSImpl)
{
    super(jmDNSImpl, 0);

    this.setTaskState(DNSState.CANCELING_1);
    this.associate(DNSState.CANCELING_1);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:Canceler.java

示例8: Prober

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Prober(JmDNSImpl jmDNSImpl)
{
    super(jmDNSImpl, defaultTTL());

    this.setTaskState(DNSState.PROBING_1);
    this.associate(DNSState.PROBING_1);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:Prober.java

示例9: Renewer

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Renewer(JmDNSImpl jmDNSImpl)
{
    super(jmDNSImpl, defaultTTL());

    this.setTaskState(DNSState.ANNOUNCED);
    this.associate(DNSState.ANNOUNCED);
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:Renewer.java

示例10: ServiceInfoResolver

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public ServiceInfoResolver(JmDNSImpl jmDNSImpl, ServiceInfoImpl info)
{
    super(jmDNSImpl);
    this._info = info;
    info.setDns(this.getDns());
    this.getDns().addListener(info, DNSQuestion.newQuestion(info.getQualifiedName(), DNSRecordType.TYPE_ANY, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:8,代码来源:ServiceInfoResolver.java

示例11: RecordReaper

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
/**
 * @param jmDNSImpl
 */
public RecordReaper(JmDNSImpl jmDNSImpl) {
    super(jmDNSImpl);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:RecordReaper.java

示例12: Responder

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Responder(JmDNSImpl jmDNSImpl, DNSIncoming in, int port) {
    super(jmDNSImpl);
    this._in = in;
    this._unicast = (port != DNSConstants.MDNS_PORT);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:6,代码来源:Responder.java

示例13: Announcer

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Announcer(JmDNSImpl jmDNSImpl) {
    super(jmDNSImpl, defaultTTL());

    this.setTaskState(DNSState.ANNOUNCING_1);
    this.associate(DNSState.ANNOUNCING_1);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:Announcer.java

示例14: Canceler

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Canceler(JmDNSImpl jmDNSImpl) {
    super(jmDNSImpl, 0);

    this.setTaskState(DNSState.CANCELING_1);
    this.associate(DNSState.CANCELING_1);
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:Canceler.java

示例15: DNSStateTask

import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
/**
 * @param jmDNSImpl
 * @param ttl
 */
public DNSStateTask(JmDNSImpl jmDNSImpl, int ttl) {
    super(jmDNSImpl);
    _ttl = ttl;
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:9,代码来源:DNSStateTask.java


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