ref:
- Apache THRIFT: A Much Needed Tutorial
- 优雅地在 Java 中进行 Thrift 调用
- Thrift(Java版)到网络编程(三)—异步和NIO
- Thrift基本原理与实践
一个简单的 thrift 接口定义,simple.thift
service SimpleService {
void parse();
}
thrift 可以根据 simple.thrift 文件生成中间代码:
thrift --gen java
生成的 java 代码中与客户端相关的包括下面几部分(省略了具体内容):
public class SimpleService {
public interface Iface {}
public interface AsyncIface {}
public static class Client {}
public static class AsyncClient {}
}
在 intellij 中可以查看 uml 图,