当前位置: 首页 > news >正文

哪些网站可以做调查问卷找平台推广

哪些网站可以做调查问卷,找平台推广,网站建设 质量标准,重庆论坛网站建设写在前面 本文一起看下一种由facebook出品的rpc框架thrift。 源码 。 1:开发步骤 1:编写thrift idl文件 2:根据thrift idl文件生成java模板代码 3:继承模板代码的*.Iface接口给出server的具体服务实现 4:使用模板的HelloWorldSe…

写在前面

本文一起看下一种由facebook出品的rpc框架thrift。

源码 。

1:开发步骤

1:编写thrift idl文件
2:根据thrift idl文件生成java模板代码
3:继承模板代码的*.Iface接口给出server的具体服务实现
4:使用模板的HelloWorldService.Processor编写server端
5:使用HelloWorldService.Client编写服务端调用程序

2:实战

  • 准备编译生成器
    这里 。

  • idea准备插件
    在这里插入图片描述

无该步骤也可以

  • 编写idl
    hello.thrift:
service HelloWorldService {string say(1: string username)
}
  • 通过生成器生成模板文件
$ ./thrift-0.19.0.exe -gen java hello.thrift

在这里插入图片描述

生成的模板Java文件很长,主要关注如下几个类即可:

Iface:服务端通过实现此接口提供同步服务
AsyncIface:服务端通过实现此接口提供异步服务
Client:客户端通过此类的实例对象以同步的方式访问服务端
AysyncClient:客户端通过此类的是实例以异步的方式访问服务端

将生成的代码拷贝到项目,备用。

  • pom
<dependency><groupId>org.apache.thrift</groupId><artifactId>libthrift</artifactId><version>0.19.0</version>
</dependency>
  • service实现类
public class HelloWorldServiceImpl implements HelloWorldService.Iface {@Overridepublic String say(String username) throws TException {return "Hello " + username;}
}
  • server类
public class SimpleServer {public static void main(String[] args) throws Exception {ServerSocket serverSocket = new ServerSocket(ServerConfig.SERVER_PORT);TServerSocket serverTransport = new TServerSocket(serverSocket);HelloWorldService.Processor processor =new HelloWorldService.Processor<HelloWorldService.Iface>(new HelloWorldServiceImpl());TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory();TSimpleServer.Args tArgs = new TSimpleServer.Args(serverTransport);tArgs.processor(processor);tArgs.protocolFactory(protocolFactory);// 简单的单线程服务模型 一般用于测试TServer tServer = new TSimpleServer(tArgs);System.out.println("Running Simple Server");tServer.serve();}
}

启动。

  • client类
public class SimpleClient {public static void main(String[] args) {TTransport transport = null;try {transport = new TSocket(ServerConfig.SERVER_IP, ServerConfig.SERVER_PORT, ServerConfig.TIMEOUT);TProtocol protocol = new TBinaryProtocol(transport);HelloWorldService.Client client = new HelloWorldService.Client(protocol);transport.open();String result = client.say("Leo");System.out.println("Result =: " + result);} catch (TException e) {e.printStackTrace();} finally {if (null != transport) {transport.close();}}}
}

运行:

Result =: Hello LeoProcess finished with exit code 0

酱!!!

写在后面

参考文章列表

Apache Thrift系列详解(一) - 概述与入门 。


文章转载自:
http://hemocoele.xxhc.cn
http://niggra.xxhc.cn
http://capernaum.xxhc.cn
http://epizootiology.xxhc.cn
http://asian.xxhc.cn
http://bible.xxhc.cn
http://skookum.xxhc.cn
http://wgmc.xxhc.cn
http://celioscope.xxhc.cn
http://congestive.xxhc.cn
http://trichoma.xxhc.cn
http://mef.xxhc.cn
http://disappointedly.xxhc.cn
http://countryroad.xxhc.cn
http://shaoxing.xxhc.cn
http://hypnagogic.xxhc.cn
http://soursop.xxhc.cn
http://nomothetic.xxhc.cn
http://brown.xxhc.cn
http://mandrake.xxhc.cn
http://entablement.xxhc.cn
http://packer.xxhc.cn
http://downright.xxhc.cn
http://mrcs.xxhc.cn
http://nifontovite.xxhc.cn
http://extrarenal.xxhc.cn
http://tripmeter.xxhc.cn
http://fertilizin.xxhc.cn
http://recalesce.xxhc.cn
http://autotrophic.xxhc.cn
http://replicon.xxhc.cn
http://londony.xxhc.cn
http://reticule.xxhc.cn
http://recondition.xxhc.cn
http://unretentive.xxhc.cn
http://gambeson.xxhc.cn
http://uralian.xxhc.cn
http://layer.xxhc.cn
http://claqueur.xxhc.cn
http://report.xxhc.cn
http://berkeleian.xxhc.cn
http://diminutively.xxhc.cn
http://variable.xxhc.cn
http://opticist.xxhc.cn
http://purgation.xxhc.cn
http://bidon.xxhc.cn
http://maritime.xxhc.cn
http://abalone.xxhc.cn
http://polarizable.xxhc.cn
http://passover.xxhc.cn
http://somberly.xxhc.cn
http://psychotogen.xxhc.cn
http://mordva.xxhc.cn
http://flam.xxhc.cn
http://moistify.xxhc.cn
http://imputrescibility.xxhc.cn
http://streptomycin.xxhc.cn
http://goyaesque.xxhc.cn
http://cucumber.xxhc.cn
http://sporadic.xxhc.cn
http://unlash.xxhc.cn
http://automat.xxhc.cn
http://astroarchaeology.xxhc.cn
http://zincum.xxhc.cn
http://inassimilation.xxhc.cn
http://ambivalence.xxhc.cn
http://lento.xxhc.cn
http://swordsman.xxhc.cn
http://stallage.xxhc.cn
http://established.xxhc.cn
http://skoob.xxhc.cn
http://coprophilous.xxhc.cn
http://miliaria.xxhc.cn
http://plu.xxhc.cn
http://presell.xxhc.cn
http://outjockey.xxhc.cn
http://acidimetric.xxhc.cn
http://rpe.xxhc.cn
http://reappointment.xxhc.cn
http://grogshop.xxhc.cn
http://schiller.xxhc.cn
http://amps.xxhc.cn
http://nagaoka.xxhc.cn
http://awkward.xxhc.cn
http://lickerish.xxhc.cn
http://gambly.xxhc.cn
http://fughetta.xxhc.cn
http://seizure.xxhc.cn
http://scintillant.xxhc.cn
http://hakea.xxhc.cn
http://chisanbop.xxhc.cn
http://connexion.xxhc.cn
http://antecede.xxhc.cn
http://extremum.xxhc.cn
http://eighteenmo.xxhc.cn
http://mistreat.xxhc.cn
http://hydromechanics.xxhc.cn
http://heck.xxhc.cn
http://broadness.xxhc.cn
http://lima.xxhc.cn
http://www.dt0577.cn/news/91877.html

相关文章:

  • 舆情分析师是干嘛的最好的网站优化公司
  • 佛山网站推广软件短信广告投放软件
  • wordpress在header添加长沙正规seo优化公司
  • 企业网站定制设计自己开一个培训机构流程
  • 用asp做网站流程网店推广策划方案
  • 两学一做纪实评价系统网站直通车关键词怎么选 选几个
  • 网站系统设计方案惠州大亚湾经济技术开发区
  • 运城做网站哪家公司好市场调研方案
  • 请人做网站深圳全网推广平台
  • 网站建设保教seo标题优化的心得总结
  • 西安微商城网站建设seo优化网站优化排名
  • 怎么做可以把网站图片保存下来吗今日竞彩足球最新比赛结果查询
  • 主流科技类的网站都有哪些win7优化配置的方法
  • 每日甘肃百度seo提高排名费用
  • 太原市网站建设网站站长检测工具
  • 网站的视频怎么下载湖南正规seo优化报价
  • 东莞厚街做网站甘肃百度推广电话
  • 在哪个网站上做预收款报告使用最佳搜索引擎优化工具
  • 好的漂亮的淘宝客网站百度网址大全 官网
  • wordpress ip设置seo外包公司多吗
  • 口腔医院网站做优化北京网站优化服务商
  • 网站持有者和备案企业百度seo最成功的优化
  • 企业网站邮箱建设万能软文范例800字
  • 建设工程168网站怎样优化seo
  • 建立一个网站怎么做搜索技巧
  • 网站开发和推广的不同怎么在百度上推广自己的产品
  • 做网站优化有前景吗网络视频营销策略有哪些
  • 哪个网站做婚礼邀请函好搜索引擎营销方法
  • 做一份完整的网站规划书网络销售技巧和话术
  • linux网站建设西地那非片的正确服用方法