本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例9: Renewer
import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
public Renewer(JmDNSImpl jmDNSImpl)
{
super(jmDNSImpl, defaultTTL());
this.setTaskState(DNSState.ANNOUNCED);
this.associate(DNSState.ANNOUNCED);
}
示例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));
}
示例11: RecordReaper
import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
/**
* @param jmDNSImpl
*/
public RecordReaper(JmDNSImpl jmDNSImpl) {
super(jmDNSImpl);
}
示例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);
}
示例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);
}
示例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);
}
示例15: DNSStateTask
import javax.jmdns.impl.JmDNSImpl; //导入依赖的package包/类
/**
* @param jmDNSImpl
* @param ttl
*/
public DNSStateTask(JmDNSImpl jmDNSImpl, int ttl) {
super(jmDNSImpl);
_ttl = ttl;
}