File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed
library/src/main/java/com/qiniu/android/http/dns Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1+ package com .qiniu .android .http .dns ;
2+
3+ import java .util .concurrent .ExecutorService ;
4+ import java .util .concurrent .LinkedBlockingQueue ;
5+ import java .util .concurrent .ThreadPoolExecutor ;
6+ import java .util .concurrent .TimeUnit ;
7+
8+ class BaseDns {
9+ int timeout = 10 ;
10+ static final ExecutorService executor = new ThreadPoolExecutor (0 , 4 ,
11+ 60L , TimeUnit .SECONDS , new LinkedBlockingQueue <Runnable >());
12+ }
Original file line number Diff line number Diff line change 1515import java .util .concurrent .ThreadPoolExecutor ;
1616import java .util .concurrent .TimeUnit ;
1717
18- public class HttpDns implements Dns {
18+ public class HttpDns extends BaseDns implements Dns {
1919
2020 private IResolver httpIpv4Resolver ;
2121 private IResolver httpIpv6Resolver ;
2222
23- private static final ExecutorService executor = new ThreadPoolExecutor (0 , 4 ,
24- 60L , TimeUnit .SECONDS , new LinkedBlockingQueue <Runnable >());
25-
2623 public HttpDns (int timeout ) {
2724 String [] dohIpv4Servers = GlobalConfiguration .getInstance ().getDohIpv4Servers ();
2825 if (dohIpv4Servers != null && dohIpv4Servers .length > 0 ) {
Original file line number Diff line number Diff line change 1919/**
2020 * Created by yangsen on 2020/5/28
2121 */
22- public class SystemDns implements Dns {
23-
24- private int timeout = 10 ;
25- private static final ExecutorService executor = new ThreadPoolExecutor (0 , 4 ,
26- 60L , TimeUnit .SECONDS , new LinkedBlockingQueue <Runnable >());
22+ public class SystemDns extends BaseDns implements Dns {
2723
2824 public SystemDns () {
2925 }
Original file line number Diff line number Diff line change 1515import java .util .concurrent .ThreadPoolExecutor ;
1616import java .util .concurrent .TimeUnit ;
1717
18- public class UdpDns implements Dns {
18+ public class UdpDns extends BaseDns implements Dns {
1919 private IResolver udpIpv4Resolver ;
2020 private IResolver udpIpv6Resolver ;
2121
22- private static final ExecutorService executor = new ThreadPoolExecutor (0 , 4 ,
23- 60L , TimeUnit .SECONDS , new LinkedBlockingQueue <Runnable >());
24-
2522 public UdpDns (int timeout ) {
2623 String [] udpIpv4Servers = GlobalConfiguration .getInstance ().getUdpDnsIpv4Servers ();
2724 if (udpIpv4Servers != null && udpIpv4Servers .length > 0 ) {
You can’t perform that action at this time.
0 commit comments