File tree Expand file tree Collapse file tree 7 files changed +46
-4
lines changed
androidTest/java/com/qiniu/android
main/java/com/qiniu/android Expand file tree Collapse file tree 7 files changed +46
-4
lines changed Original file line number Diff line number Diff line change 11#Changelog
2+ ## 8.4.1(2022-01-27)
3+ * 优化 SystemDns 解析:异步开线程池,降低高并发场景下对内存资源占用。
4+
5+
26## 8.4.0(2021-12-07)
37* 优化:
48 * DNS 预解析支持 DoH (DNS over HTTPS)
Original file line number Diff line number Diff line change 33 <component name =" FacetManager" >
44 <facet type =" java-gradle" name =" Java-Gradle" >
55 <configuration >
6+ <option name =" BUILD_FOLDER_PATH" />
67 <option name =" BUILDABLE" value =" false" />
78 </configuration >
89 </facet >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ https://github.com/qiniudemo/qiniu-lab-android
1515
1616| Qiniu SDK 版本 | 最低 Android版本 | 依赖库版本 |
1717| ------------ | -----------------| ------------------------|
18- | 8.4.0 | Android 4.0+ | okhttp 4+ |
18+ | 8.4.* | Android 4.0+ | okhttp 4+ |
1919| 8.3.2 | Android 4.0+ | okhttp 4+ |
2020| 8.3.1 | Android 4.0+ | okhttp 4+ |
2121| 8.3.0 | Android 5.0+ | okhttp 4+ |
@@ -33,7 +33,7 @@ https://github.com/qiniudemo/qiniu-lab-android
3333| 7.0.7 | Android 2.2+ | android-async-http 1.4.8 |
3434
3535### 注意
36- * 推荐使用最新版:8.4.0
36+ * 推荐使用最新版:8.4.1
3737* 7.6.2 ~ 8.3.2 AndroidNetwork.getMobileDbm()可以获取手机信号强度,需要如下权限(API>=18时生效)
3838```
3939 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Original file line number Diff line number Diff line change 1+ package com .qiniu .android ;
2+
3+ import com .qiniu .android .http .dns .IDnsNetworkAddress ;
4+ import com .qiniu .android .http .dns .SystemDns ;
5+ import com .qiniu .android .utils .Utils ;
6+
7+ import java .net .UnknownHostException ;
8+ import java .util .List ;
9+
10+ public class SystemDnsTest extends BaseTest {
11+
12+ public void testDnsLookup () {
13+ SystemDns dns = new SystemDns (5 );
14+ try {
15+ List <IDnsNetworkAddress > result = dns .lookup ("upload.qiniup.com" );
16+ assertTrue ("testDnsLookup fail:" , result != null && result .size () > 0 );
17+ } catch (UnknownHostException e ) {
18+ e .printStackTrace ();
19+ fail ("testDnsLookup fail because:" + e .getMessage ());
20+ }
21+ }
22+
23+ public void testDnsTimeout () {
24+ long start = Utils .currentSecondTimestamp ();
25+ int timeout = 5 ;
26+ SystemDns dns = new SystemDns (timeout );
27+ try {
28+ List <IDnsNetworkAddress > result = dns .lookup ("a.a.a.cn" );
29+ assertTrue ("testDnsTimeout fail:" , result == null || result .size () == 0 );
30+ } catch (UnknownHostException e ) {
31+ e .printStackTrace ();
32+ }
33+ long end = Utils .currentSecondTimestamp ();
34+ assertTrue ("testDnsTimeout fail because timeout to long" , end <= (start + timeout + 1 ));
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ public final class TestConfig {
2727 public static final String bucket_fog_cn_east1 = "test-fog-cn-east-1" ;
2828 public static final String token_fog_cn_east1 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:JPPu4hG6dc9AMTBag4eAujK_ldI=:eyJzY29wZSI6InRlc3QtZm9nLWNuLWVhc3QtMSIsImRlYWRsaW5lIjoxNjQ2NjMzMjM1LCAicmV0dXJuQm9keSI6IntcImNhbGxiYWNrVXJsXCI6XCJodHRwOlwvXC9jYWxsYmFjay5kZXYucWluaXUuaW9cIiwgXCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9" ;
2929 public static final String invalidBucketToken = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:4y0ZaTdcqRcyMloKt_ujblr-WUA=:eyJzY29wZSI6InpvbmVfaW52YWxpZCIsImRlYWRsaW5lIjoxNjQ2NjMzMjM1LCAicmV0dXJuQm9keSI6IntcImNhbGxiYWNrVXJsXCI6XCJodHRwOlwvXC9jYWxsYmFjay5kZXYucWluaXUuaW9cIiwgXCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9" ;
30+
3031 // -----------
3132 public static final String ak = "bjtWBQXrcxgo7HWwlC_bgHg81j352_GhgBGZPeOW" ;
3233
Original file line number Diff line number Diff line change 22
33
44public final class Constants {
5- public static final String VERSION = "8.4.0 " ;
5+ public static final String VERSION = "8.4.1 " ;
66
77 public static final String UTF_8 = "utf-8" ;
88}
Original file line number Diff line number Diff line change 2222public class SystemDns implements Dns {
2323
2424 private int timeout = 10 ;
25- private final ExecutorService executor = new ThreadPoolExecutor (1 , 3 ,
25+ private static final ExecutorService executor = new ThreadPoolExecutor (1 , 3 ,
2626 60L , TimeUnit .SECONDS , new LinkedBlockingQueue <Runnable >());
2727
2828 public SystemDns () {
You can’t perform that action at this time.
0 commit comments