Tag: 节俭

Apache Thrift中的通用对象

我想知道我是否可以使用IDL语言在Apache Thrift中定义“通用对象”,类似Java中的“Object”类。 我需要发送任何类型的对象列表,但我不知道如何在file.thrift中定义它 喜欢这个: struct { 1: list listObjects; } 要么 struct { 1: list listObjects; }

使用TFramedTransport时出现TTransportException

我很困惑这个问题。 我有一个Apache Thrift 0.9.0客户端和服务器。 客户端代码如下: this.transport = new TSocket(this.server, this.port); final TProtocol protocol = new TBinaryProtocol(this.transport); this.client = new ZKProtoService.Client(protocol); 这很好用。 但是,如果我尝试将传输包装在TFramedTransport this.transport = new TSocket(this.server, this.port); final TProtocol protocol = new TBinaryProtocol(new TFramedTransport(this.transport)); this.client = new ZKProtoService.Client(protocol); 我在客户端获得以下模糊(没有任何解释消息)exception。 服务器端显示没有错误。 org.apache.thrift.transport.TTransportException at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84) at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129) at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84) at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378) at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297) […]

服务器/客户端之间的文件传输

我应该为“.thrift”-file定义什么样的服务,以便稍后在我的程序中使用它? 此文件传输应位于客户端和服务器之间,它应该“部分”。 StreamFileService.thrift: struct FileChunk { 1: binary data 2: i64 remaining } service StreamFileService { FileChunk getBytes(1:string fileName, 2: i64 offset, 3: i32 size); } StreamFileClient.java: public class StreamFileClient { private int fileChunkSize = 16; private String filePath; public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } […]

循环遍历maven中的特定资源文件以生成源

我使用maven-antrun-plugin从thrift IDL生成源代码。 我有一个单独的项目(和jar)来保存这些生成的源,这个插件不支持通配符替换,所以我不能说* .thrift。 我使用执行任务来生成源并将它们复制到src目录。 我定义了以下插件 maven-antrun-plugin generate-sources generate-sources run 现在如果我想使用另一个thrift IDL,那么我需要为该特定文件再定义一次执行。 我不想为每个添加的IDL做这个,我想说选择所有的thrift文件并生成源代码。 有办法吗?

如何使用thrift生成器作为maven依赖(如何避免引用.exe文件)?

我在pom.xml有以下内容: … … org.apache.thrift libthrift 0.11.0 org.apache.thrift.tools maven-thrift-plugin 0.1.11 D:/work/thrift-folder/thrift-0.11.0.exe ../thrift-files java thrift-sources generate-sources compile 它很好但我不喜欢在我的源代码中引用.exe文件: D:/work/thrift-folder/thrift-0.11.0.exe 是否可以使用maven依赖? 怎么样?

为什么我收到java.lang.AbstractMethodError错误?

ABstractMethodError的可能原因是什么? 线程“pool-1-thread-1”中的exceptionjava.lang.AbstractMethodError: org.apache.thrift.ProcessFunction.isOneway()Z at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:51) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) at com.gemfire.gemstone.thrift.hbase.ThreadPoolServer$ClientConnnection.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)