本文整理了Java中org.xbill.DNS.Resolver.setTimeout
方法的一些代码示例,展示了Resolver.setTimeout
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resolver.setTimeout
方法的具体详情如下:
包路径:org.xbill.DNS.Resolver
类名称:Resolver
方法名:setTimeout
暂无
代码示例来源:origin: yuliskov/SmartYouTubeTV
public GoogleResolver() {
String dns = findProperServer();
resolver = createResolver(dns);
resolver.setTimeout(RESOLVE_TIMEOUT_S);
}
代码示例来源:origin: org.apache.james.jspf/apache-jspf-resolver
/**
* NOTE if this class is created with the default constructor it
* will use the static DefaultResolver from DNSJava and this method
* will change it's timeout.
* Other tools using DNSJava in the same JVM could be affected by
* this timeout change.
*
* @see org.apache.james.jspf.core.DNSService#setTimeOut(int)
*/
public synchronized void setTimeOut(int timeOut) {
this.resolver.setTimeout(timeOut);
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
public void
setTimeout(int secs, int msecs) {
for (int i = 0; i < resolvers.size(); i++)
((Resolver)resolvers.get(i)).setTimeout(secs, msecs);
}
代码示例来源:origin: dnsjava/dnsjava
public void
setTimeout(int secs, int msecs) {
for (int i = 0; i < resolvers.size(); i++)
((Resolver)resolvers.get(i)).setTimeout(secs, msecs);
}
代码示例来源:origin: org.littleshoot/dnsjava
public void
setTimeout(int secs, int msecs) {
for (int i = 0; i < resolvers.size(); i++)
((Resolver)resolvers.get(i)).setTimeout(secs, msecs);
}
代码示例来源:origin: tiandawu/IotXmpp
public void
setTimeout(int secs, int msecs) {
for (int i = 0; i < resolvers.size(); i++)
((Resolver)resolvers.get(i)).setTimeout(secs, msecs);
}
代码示例来源:origin: org.apache.james.jspf/apache-jspf-resolver
/**
* Set the timeout for the resolvers
* @param timeout
*/
public synchronized void setTimeout(int timeout) {
Resolver[] res = resolver.getResolvers();
for (int i = 0; i < res.length; i++) {
res[i].setTimeout(timeout);
}
}
代码示例来源:origin: org.mobicents.javax.sip/mobicents-jain-sip-ext
@Override
public void setDNSTimeout(int timeout) {
Lookup.getDefaultResolver().setTimeout(timeout);
Lookup.getDefaultResolver().setTimeout(timeout, 0);
dnsTimeout = timeout;
if(logger.isInfoEnabled()) {
logger.info("DefaultDNSLookupPerformer will be using timeout of " + dnsTimeout + " seconds ");
}
}
代码示例来源:origin: org.mobicents.javax.sip/mobicents-jain-sip-ext
public DefaultDNSLookupPerformer() {
// https://code.google.com/p/jain-sip/issues/detail?id=162
dnsTimeout = DEFAULT_DNS_TIMEOUT_SECONDS;
Lookup.getDefaultResolver().setTimeout(dnsTimeout, 0);
}
代码示例来源:origin: org.apache.james/apache-jspf
/**
* Set the timeout for the resolvers
* @param timeout
*/
public synchronized void setTimeout(int timeout) {
Resolver[] res = resolver.getResolvers();
for (int i = 0; i < res.length; i++) {
res[i].setTimeout(timeout);
}
}
代码示例来源:origin: posicks/mdnsjava
/**
* {@inheritDoc}
*/
public void setTimeout(final int secs)
{
for (Querier querier : multicastResponders)
{
querier.setTimeout(secs);
}
for (Resolver resolver : unicastResolvers)
{
resolver.setTimeout(secs);
}
}
代码示例来源:origin: posicks/mdnsjava
/**
* {@inheritDoc}
*/
public void setTimeout(final int secs, final int msecs)
{
for (Querier querier : multicastResponders)
{
querier.setTimeout(secs, msecs);
}
for (Resolver resolver : unicastResolvers)
{
resolver.setTimeout(secs, msecs);
}
}
代码示例来源:origin: org.mobicents.javax.sip/mobicents-jain-sip-ext
public List<Record> performSRVLookup(String replacement) {
if(logger.isDebugEnabled()) {
logger.debug("doing SRV lookup for replacement " + replacement);
}
Record[] srvRecords = null;
try {
Lookup lookup = new Lookup(replacement, Type.SRV);
lookup.getDefaultResolver().setTimeout(dnsTimeout);
lookup.getDefaultResolver().setTimeout(dnsTimeout, 0);
srvRecords = lookup.run();
} catch (TextParseException e) {
logger.error("Impossible to parse the parameters for dns lookup",e);
}
if(srvRecords != null && srvRecords.length > 0) {
return Arrays.asList(srvRecords);
}
return new ArrayList<Record>(0);
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
/**
* Creates a new Extended Resolver
* @param servers An array of server names for which SimpleResolver
* contexts should be initialized.
* @see SimpleResolver
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver(String [] servers) throws UnknownHostException {
init();
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
代码示例来源:origin: tiandawu/IotXmpp
/**
* Creates a new Extended Resolver
* @param servers An array of server names for which SimpleResolver
* contexts should be initialized.
* @see SimpleResolver
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver(String [] servers) throws UnknownHostException {
init();
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
代码示例来源:origin: dnsjava/dnsjava
/**
* Creates a new Extended Resolver
* @param servers An array of server names for which SimpleResolver
* contexts should be initialized.
* @see SimpleResolver
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver(String [] servers) throws UnknownHostException {
init();
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
代码示例来源:origin: org.littleshoot/dnsjava
/**
* Creates a new Extended Resolver
* @param servers An array of server names for which SimpleResolver
* contexts should be initialized.
* @see SimpleResolver
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver(String [] servers) throws UnknownHostException {
init();
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi
/**
* Creates a new Extended Resolver. The default ResolverConfig is used to
* determine the servers for which SimpleResolver contexts should be
* initialized.
* @see SimpleResolver
* @see ResolverConfig
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver() throws UnknownHostException {
init();
String [] servers = ResolverConfig.getCurrentConfig().servers();
if (servers != null) {
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
else
resolvers.add(new SimpleResolver());
}
代码示例来源:origin: org.littleshoot/dnsjava
/**
* Creates a new Extended Resolver. The default ResolverConfig is used to
* determine the servers for which SimpleResolver contexts should be
* initialized.
* @see SimpleResolver
* @see ResolverConfig
* @exception UnknownHostException Failure occured initializing SimpleResolvers
*/
public
ExtendedResolver() throws UnknownHostException {
init();
String [] servers = ResolverConfig.getCurrentConfig().servers();
if (servers != null) {
for (int i = 0; i < servers.length; i++) {
Resolver r = new SimpleResolver(servers[i]);
r.setTimeout(quantum);
resolvers.add(r);
}
}
else
resolvers.add(new SimpleResolver());
}
代码示例来源:origin: org.dspace/dspace-stats
public static String reverseDns(String hostIp) throws IOException {
Resolver res = new ExtendedResolver();
// set the timeout, defaults to 200 milliseconds
int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200);
res.setTimeout(0, timeout);
Name name = ReverseMap.fromAddress(hostIp);
int type = Type.PTR;
int dclass = DClass.IN;
Record rec = Record.newRecord(name, type, dclass);
Message query = Message.newQuery(rec);
Message response = res.send(query);
Record[] answers = response.getSectionArray(Section.ANSWER);
if (answers.length == 0)
{
return hostIp;
}
else
{
return answers[0].rdataToString();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!