aliyun / aliyun-tablestore-java-sdk Goto Github PK
View Code? Open in Web Editor NEWAliyun TableStore(原OTS) JAVA SDK
Home Page: https://www.aliyun.com/product/ots/
License: Apache License 2.0
Aliyun TableStore(原OTS) JAVA SDK
Home Page: https://www.aliyun.com/product/ots/
License: Apache License 2.0
tablestore 5.3.0 对 protobuf-java 2.5.0 支持不好
Hi,
I'm working on an Android App which uses Aliyun Tablestore as database.
But problems occured.
When I place implementation ('com.aliyun.openservices:ots-public:2.2.4') in build.gradle, build and debug the App, exception thrown. Below is the stacktrace:
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicLineFormatter; in class Lorg/apache/http/message/BasicLineFormatter; or its superclasses (declaration of 'org.apache.http.message.BasicLineFormatter' appears in /system/framework/org.apache.http.legacy.boot.jar)
at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterFactory.java:46)
at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<init>(ManagedNHttpClientConnectionFactory.java:75)
at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<init>(ManagedNHttpClientConnectionFactory.java:83)
at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<clinit>(ManagedNHttpClientConnectionFactory.java:64)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingNHttpClientConnectionManager.java:522)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:161)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:145)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:117)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:111)
at com.aliyun.openservices.ots.comm.AsyncServiceClient.<init>(AsyncServiceClient.java:44)
at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:164)
at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:116)
at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:56)
at com.anpeila.dashgomonitorapp.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:7081)
at android.app.Activity.performCreate(Activity.java:7072)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2872)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6600)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:821)
Any help? Thanks!
java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED
at org.apache.http.util.Asserts.check(Asserts.java:46)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.ensureRunning(CloseableHttpAsyncClientBase.java:90)
at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:123)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:68)
at com.alicloud.openservices.tablestore.core.http.AsyncServiceClient.asyncSendRequest(AsyncServiceClient.java:150)
at com.alicloud.openservices.tablestore.core.OperationLauncher.asyncInvokePost(OperationLauncher.java:152)
at com.alicloud.openservices.tablestore.core.BatchGetRowLauncher.fire(BatchGetRowLauncher.java:63)
at com.alicloud.openservices.tablestore.InternalClient.batchGetRow(InternalClient.java:586)
at com.alicloud.openservices.tablestore.SyncClient.batchGetRow(SyncClient.java:273)
怎么检查otsclient是否处于shutdown状态???
在处理ERROR CODE的时候,要到API文档里面查询,而找API文档的错误码又要花很长时间,希望这些错误码能跟代码放在一起,方便查询。
另外,每个函数能将典型的抛出的错误码在注释里面说明一下,也会有利于处理。
Table Store sdk 有大概两秒钟的写入迟延。写入table后,马上读取,无数据。 请提供方案。
This is just a test.
目前该接口无任何入参, 而且在 Client 执行大部分操作时都会回调一次.
暂时无法理解这个回调接口的应用场景..
Provides transitive vulnerable dependency maven:com.google.guava:guava:27.0.1-jre CVE-2023-2976 7.1 Files or Directories Accessible to External Parties vulnerability with High severity found CVE-2020-8908 3.3 Incorrect Permission Assignment for Critical Resource vulnerability with Low severity found Results powered by Checkmarx(c)
Provides transitive vulnerable dependency maven:com.google.protobuf:protobuf-java:2.4.1 CVE-2022-3509 7.5 Uncontrolled Resource Consumption vulnerability with High severity found CVE-2021-22569 5.5 Incorrect Behavior Order vulnerability with Medium severity found CVE-2022-3510 7.5 Uncontrolled Resource Consumption vulnerability with High severity found CVE-2022-3171 7.5 Uncontrolled Resource Consumption vulnerability with High severity found CVE-2015-5237 8.8 Out-of-bounds Write vulnerability with High severity found Results powered by Checkmarx(c)
系统对[ErrorCode]:OTSFlowControl进行处理
如题所示
参考该地址实现:https://help.aliyun.com/document_detail/114347.html?spm=a2c4g.11186623.6.615.17132345T3bKeQ
TimestreamMetaIterator iter1 = db.metaTable()
.filter(filter)
.identifierOnly() // 只返回identifer
.fetchAll();
System.out.print(iterator.getTotalCount()); //获取命中的时间线条数
while (iter1.hasNext()) {
System.out.print(iterator.next().toString());
}
public boolean hasNext() {
if (isBufferHasData()) {
return true;
}
byte[] token = response.getNextToken();
while (token != null) {
request.getSearchQuery().setToken(response.getNextToken());
request.getSearchQuery().setOffset(0);
fetchData(request);
if (isBufferHasData()) {
return true;
}
token = response.getNextToken();
}
return false;
}
上述实现会取出所有数据,是否需要把isBufferHasData提出公共方法出来。目前实现分页,不能用这个方法,只能自己写实现
OTSMultiDataSample.java
中演示了getRange
方法的调用,demo程序中,插入了GID=1, UID范围1-5的5条数据。
getRange
设定了GID范围从1-4,但是返回的结果是所有1-5的条目,这里demo是有些问题的,返回1-5是正常的。
但是我把查询程序改成GID范围INF_MIN-INF_MAX,UID范围设置成1-4时仍然返回所有结果,这里是不是存在一些bug?
使用BatchGetRow功能查询批量数据,查询一条不存在的数据,BatchGetRowResponse正常返回,取RowResult值的时候发现:isSuccess为true,但Row为null。
public class BatchGetRowResponse extends Response implements Jsonizable {
/**
* BatchGetRow批量操作中单行查询的结果。
* 若isSucceed为true,则代表该行查询操作成功,可以通过getRow获取单行查询的结果。
* 若isSucceed为false,则代表该行查询操作失败,可以通过getError获取失败的错误信息。
*/
public static class RowResult {}
}
private <T> void getBatchRow(Class<T> clazz, String table, List<PrimaryKey> pks) throws Exception {
//读取一行数据,设置数据表名称。
MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(table);
//设置读取最新版本。
criteria.setMaxVersions(1);
// 添加主键
for(PrimaryKey pk : pks){
criteria.addRow(pk);
}
// 执行查询
BatchGetRowRequest request = new BatchGetRowRequest();
request.addMultiRowQueryCriteria(criteria);
BatchGetRowResponse response = client.batchGetRow(request);
List<RowResult> rowRsts = response.getBatchGetRowResult(table);
if (rowRsts.isEmpty()) {
return Collections.emptyList();
}
for(RowResult rowRst : rowRsts){
if(!rowRst.isSucceed()){
continue;
}
Row row = rowRst.getRow();
if(row.isEmpty()){
continue;
}
System.out.println(row);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.