Skip to content

Commit e569d2a

Browse files
committed
update version to 5.17.0
1 parent 967c41e commit e569d2a

File tree

225 files changed

+46942
-17544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+46942
-17544
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
- 阿里云表格存储是阿里云自主研发的NoSQL数据存储服务,提供海量结构化数据的存储和实时访问。
1010

1111
## 版本
12-
- 当前版本:5.16.1
12+
- 当前版本:5.17.0
1313

1414
## 运行环境
1515
- JDK 6及其以上
1616

1717
## 安装
1818
#### Maven方式
19-
下载[最新版JAR包](https://search.maven.org/remotecontent?filepath=com/aliyun/openservices/tablestore/5.16.1/tablestore-5.16.1.jar)或者通过Maven:
19+
下载[最新版JAR包](https://search.maven.org/remotecontent?filepath=com/aliyun/openservices/tablestore/5.17.0/tablestore-5.17.0.jar)或者通过Maven:
2020
```xml
2121
<dependency>
2222
<groupId>com.aliyun.openservices</groupId>
2323
<artifactId>tablestore</artifactId>
24-
<version>5.16.1</version>
24+
<version>5.17.0</version>
2525
</dependency>
2626
```
2727

pom.xml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.aliyun.openservices</groupId>
55
<artifactId>tablestore</artifactId>
6-
<version>5.16.3</version>
6+
<version>5.17.0</version>
77
<packaging>jar</packaging>
88
<name>AliCloud TableStore SDK for Java</name>
9-
<url>http://www.aliyun.com</url>
9+
<url>http://www.aliyun.com</url>
1010
<description>Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com</description>
1111
<licenses>
1212
<license>
@@ -50,7 +50,7 @@
5050
<dependency>
5151
<groupId>junit</groupId>
5252
<artifactId>junit</artifactId>
53-
<version>4.10</version>
53+
<version>4.10</version>
5454
<scope>test</scope>
5555
</dependency>
5656
<dependency>
@@ -120,8 +120,8 @@
120120
<artifactId>maven-compiler-plugin</artifactId>
121121
<version>2.3.2</version>
122122
<configuration>
123-
<source>1.6</source>
124-
<target>1.6</target>
123+
<source>1.8</source>
124+
<target>1.8</target>
125125
<encoding>UTF-8</encoding>
126126
</configuration>
127127
</plugin>
@@ -147,9 +147,9 @@
147147
<plugin>
148148
<groupId>org.apache.maven.plugins</groupId>
149149
<artifactId>maven-surefire-plugin</artifactId>
150-
<version>2.10</version>
150+
<version>3.2.2</version>
151151
<configuration>
152-
<argLine>-Dfile.encoding=UTF-8</argLine>
152+
<argLine>@{argLine} -Dfile.encoding=UTF-8</argLine>
153153
</configuration>
154154
<executions>
155155
<execution>
@@ -226,7 +226,12 @@
226226
<exclude>commons-codec:commons-codec:jar:</exclude>
227227
<exclude>org.hamcrest:hamcrest-core:jar:</exclude>
228228
<exclude>com.google.code.gson:gson:jar:</exclude>
229-
<exclude>com.google.guava:guava:jar:</exclude>
229+
<exclude>com.google.guava:*</exclude>
230+
<exclude>com.google.errorprone:*</exclude>
231+
<exclude>com.google.code.findbugs:*</exclude>
232+
<exclude>org.checkerframework:*</exclude>
233+
<exclude>com.google.j2objc:*</exclude>
234+
<exclude>org.codehaus.mojo:*</exclude>
230235
</excludes>
231236
</artifactSet>
232237
<relocations>
@@ -271,17 +276,27 @@
271276
</goals>
272277
</execution>
273278
</executions>
274-
</plugin>
279+
</plugin>
275280
<plugin>
276-
<groupId>org.apache.maven.plugins</groupId>
277-
<artifactId>maven-gpg-plugin</artifactId>
278-
<version>1.5</version>
281+
<groupId>org.jacoco</groupId>
282+
<artifactId>jacoco-maven-plugin</artifactId>
283+
<version>0.8.10</version>
284+
<configuration>
285+
<excludes>
286+
<exclude>**/examples/*.java</exclude>
287+
</excludes>
288+
</configuration>
279289
<executions>
280290
<execution>
281-
<id>sign-artifacts</id>
282-
<phase>verify</phase>
291+
<id>default-prepare-agent</id>
292+
<goals>
293+
<goal>prepare-agent</goal>
294+
</goals>
295+
</execution>
296+
<execution>
297+
<id>default-report</id>
283298
<goals>
284-
<goal>sign</goal>
299+
<goal>report</goal>
285300
</goals>
286301
</execution>
287302
</executions>
@@ -292,11 +307,11 @@
292307
<version>1.6.3</version>
293308
<extensions>true</extensions>
294309
<configuration>
295-
<serverId>sonatype-nexus-staging</serverId>
296-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
297-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
310+
<serverId>sonatype-nexus-staging</serverId>
311+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
312+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
298313
</configuration>
299314
</plugin>
300315
</plugins>
301-
</build>
316+
</build>
302317
</project>

src/main/java/com/alicloud/openservices/tablestore/ClientConfiguration.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,19 @@ public class ClientConfiguration {
4949
private int dnsCacheExpireAfterWriteSec = 600;
5050
private int dnsCacheRefreshAfterWriteSec = 300;
5151

52-
5352
/**
5453
* 链路追踪系统接口
5554
*/
5655
private RequestTracer requestTracer;
5756

57+
/**
58+
* 设置SSL session的cache size和timeout;
59+
* 没有配置则使用JDK默认值:
60+
* 通过SSLContexts.createDefault().getSessionCacheSize()和SSLContexts.createDefault().getSessionTimeout()查看默认值
61+
*/
62+
private int sslSessionCacheSize = -1; // -1代表没有配置
63+
private int sslSessionTimeoutInSec = -1; // -1代表没有配置
64+
5865
/**
5966
* 构造新实例。
6067
*/
@@ -542,4 +549,38 @@ public void setRequestTracer(RequestTracer requestTracer) {
542549
public RequestTracer getRequestTracer() {
543550
return requestTracer;
544551
}
552+
553+
/**
554+
* 设置ssl session的cache size
555+
*
556+
* @param sslSessionCacheSize ssl session的cache size
557+
*/
558+
public void setSslSessionCacheSize(int sslSessionCacheSize) {
559+
Preconditions.checkArgument(sslSessionCacheSize >= 0, "SSL session cache size should be no less than 0.");
560+
this.sslSessionCacheSize = sslSessionCacheSize;
561+
}
562+
563+
/**
564+
* 获取ssl session的cache size
565+
*
566+
* @return sslSessionCacheSize
567+
*/
568+
public int getSslSessionCacheSize() { return sslSessionCacheSize; }
569+
570+
/**
571+
* 设置ssl session的timeout
572+
*
573+
* @param seconds ssl session的timeout,0代表没有限制;timeout大小应不小于0,秒为单位
574+
*/
575+
public void setSslSessionTimeoutInSec(int seconds) {
576+
Preconditions.checkArgument(seconds >= 0, "SSL session timeout should be no less than 0.");
577+
this.sslSessionTimeoutInSec = seconds;
578+
}
579+
580+
/**
581+
* 获取ssl session的timeout
582+
*
583+
* @return sslSessionTimeout ssl session的timeout,0代表没有限制,-1代表没有配置;timeout以秒为单位
584+
*/
585+
public int getSslSessionTimeoutInSec() { return sslSessionTimeoutInSec; }
545586
}

src/main/java/com/alicloud/openservices/tablestore/core/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
public class Constants {
66
// ALL HTTP HEADERS SHOULD BE DEFINED IN LOWERCASE
77
// request headers
8-
public static final String USER_AGENT = "ots-java-sdk 5.16.3";
8+
public static final String USER_AGENT = "ots-java-sdk 5.17.0";
99
public static final String OTS_HEADER_API_VERSION = "x-ots-apiversion";
1010
public static final String OTS_HEADER_ACCESS_KEY_ID = "x-ots-accesskeyid";
1111
public static final String OTS_HEADER_OTS_CONTENT_MD5 = "x-ots-contentmd5";

src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsFetcher.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919

2020
package com.alicloud.openservices.tablestore.core.auth;
2121

22+
import java.net.MalformedURLException;
23+
import java.net.URL;
24+
2225
import com.alicloud.openservices.tablestore.ClientException;
2326
import com.alicloud.openservices.tablestore.core.utils.HttpResponse;
2427
import com.google.gson.Gson;
2528
import com.google.gson.annotations.SerializedName;
2629
import org.slf4j.Logger;
2730
import org.slf4j.LoggerFactory;
2831

29-
import java.net.MalformedURLException;
30-
import java.net.URL;
31-
3232
public class InstanceProfileCredentialsFetcher extends HttpCredentialsFetcher {
3333

3434
private Logger logger = LoggerFactory.getLogger(InstanceProfileCredentialsFetcher.class);
@@ -76,18 +76,23 @@ private static class MetadataResponse {
7676

7777
@Override
7878
public ServiceCredentials parse(HttpResponse response) throws ClientException {
79+
if (response.getHttpContent() == null) {
80+
logger.error("Invalid response from ECS Metadata service: null.");
81+
throw new ClientException("Invalid json got from ECS Metadata service.");
82+
}
83+
7984
String jsonContent = new String(response.getHttpContent());
8085

8186
try {
8287
MetadataResponse res = new Gson().fromJson(jsonContent, MetadataResponse.class);
8388
if (res == null) {
84-
logger.error("Invalid response form ECS Metadata service: {}.", jsonContent);
89+
logger.error("Invalid response from ECS Metadata service: {}.", jsonContent);
8590
throw new ClientException("Invalid json got from ECS Metadata service.");
8691
}
8792

8893
if (!(res.code != null && res.accessKeyId != null && res.accessKeySecret != null
8994
&& res.securityToken != null && res.expiration != null)) {
90-
logger.error("Invalid response form ECS Metadata service: {}.", jsonContent);
95+
logger.error("Invalid response from ECS Metadata service: {}.", jsonContent);
9196
throw new ClientException("Invalid json got from ECS Metadata service.");
9297
}
9398

src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public InstanceProfileCredentials getCredentials() {
7474
} else if (shouldRefreshCredentials()) {
7575
try {
7676
isFetching.set(true);
77-
credentials = (InstanceProfileCredentials) fetcher.fetch();
77+
credentials = (InstanceProfileCredentials) fetcher.fetch(maxRetryTimes);
7878
} catch (ClientException e) {
7979
// Use the current expiring session token and wait for next round
8080
credentials.setLastFailedRefreshTime();

src/main/java/com/alicloud/openservices/tablestore/core/http/AsyncServiceClient.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.apache.http.config.Registry;
1212
import org.apache.http.config.RegistryBuilder;
1313
import org.apache.http.conn.DnsResolver;
14+
import org.apache.http.conn.ssl.SSLContexts;
1415
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
1516
import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
1617
import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
@@ -29,6 +30,8 @@
2930
import com.alicloud.openservices.tablestore.core.TraceLogger;
3031
import com.alicloud.openservices.tablestore.core.utils.Preconditions;
3132

33+
import javax.net.ssl.SSLContext;
34+
3235
import static com.alicloud.openservices.tablestore.core.utils.LogUtil.*;
3336

3437
public class AsyncServiceClient {
@@ -42,9 +45,19 @@ public AsyncServiceClient(ClientConfiguration config) {
4245
.setIoThreadCount(config.getIoThreadCount()).build();
4346
ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(
4447
ioReactorConfig);
48+
49+
SSLContext sslContext = SSLContexts.createDefault();
50+
if (config.getSslSessionCacheSize() >= 0) {
51+
sslContext.getClientSessionContext().setSessionCacheSize(config.getSslSessionCacheSize());
52+
}
53+
if (config.getSslSessionTimeoutInSec() >= 0) {
54+
sslContext.getClientSessionContext().setSessionTimeout(config.getSslSessionTimeoutInSec());
55+
}
56+
SSLIOSessionStrategy sslioSessionStrategy = new SSLIOSessionStrategy(sslContext, SSLIOSessionStrategy.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
57+
4558
Registry<SchemeIOSessionStrategy> iosessionFactoryRegistry = RegistryBuilder.<SchemeIOSessionStrategy>create()
4659
.register("http", NoopIOSessionStrategy.INSTANCE)
47-
.register("https", SSLIOSessionStrategy.getDefaultStrategy())
60+
.register("https", sslioSessionStrategy)
4861
.build();
4962
DnsResolver dnsResolver = null;
5063
if (config.isEnableDnsCache()) {

src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolParser.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.alicloud.openservices.tablestore.ClientException;
44
import com.alicloud.openservices.tablestore.model.*;
5+
import com.alicloud.openservices.tablestore.model.search.SyncStat;
56
import com.alicloud.openservices.tablestore.model.sql.SQLPayloadVersion;
67
import com.alicloud.openservices.tablestore.model.sql.SQLStatementType;
78

@@ -86,6 +87,13 @@ public static IndexUpdateMode parseIndexUpdateMode(OtsInternalApi.IndexUpdateMod
8687
}
8788
}
8889

90+
public static SyncStat.SyncPhase parseIndexSyncPhase(OtsInternalApi.IndexSyncPhase indexSyncPhase) {
91+
if (indexSyncPhase == OtsInternalApi.IndexSyncPhase.ISP_INCR) {
92+
return SyncStat.SyncPhase.INCR;
93+
}
94+
return SyncStat.SyncPhase.FULL;
95+
}
96+
8997
public static IndexMeta parseIndexMeta(OtsInternalApi.IndexMeta indexMeta) {
9098
IndexMeta result = new IndexMeta(indexMeta.getName());
9199
for (String pk : indexMeta.getPrimaryKeyList()) {
@@ -96,6 +104,9 @@ public static IndexMeta parseIndexMeta(OtsInternalApi.IndexMeta indexMeta) {
96104
}
97105
result.setIndexType(parseIndexType(indexMeta.getIndexType()));
98106
result.setIndexUpdateMode(parseIndexUpdateMode(indexMeta.getIndexUpdateMode()));
107+
if (indexMeta.hasIndexSyncPhase()) {
108+
result.setIndexSyncPhase(parseIndexSyncPhase(indexMeta.getIndexSyncPhase()));
109+
}
99110

100111
return result;
101112
}

0 commit comments

Comments
 (0)