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

怎么做企业网站太原关键词排名推广

怎么做企业网站,太原关键词排名推广,零基础学wordpress pdf下载,照片处理在线Thrift快速入门开发demo 一、认识Thrift thrift是什么?一个RPC 代码生成框架,使用它的IDL(Interface Defination Language,接口定义语言)定义你想要实现的接口,然后它就会生成对应语言的远程调用框架代码,用户只需要实现接口逻辑,不用关心具体的细节。 tutorial:htt…

Thrift快速入门开发demo

一、认识Thrift

thrift是什么?一个RPC 代码生成框架,使用它的IDL(Interface Defination Language,接口定义语言)定义你想要实现的接口,然后它就会生成对应语言的远程调用框架代码,用户只需要实现接口逻辑,不用关心具体的细节。

tutorial:http://digital-madness.in/blog/wp-content/uploads/2012/11/BSD_08_2013.8-18.pdf

二、快速入门开发一个Demo

2.1 开发逻辑

  1. 编写IDL文件
  2. 使用IDL文件生成对应Java代码
  3. 拷贝Java代码到对应项目目录
  4. 实现接口逻辑
  5. 编写server端
  6. 编写client端

thrift --gen java /users/ccl/workspace/demo

2.2 编写IDL文件

Thrift具体语法参考官方文档Thrift interface description language

  • data.thrift
namespace java thrift.gentypedef i16 short
typedef i32 int
typedef i64 long
typedef bool boolean
typedef string Stringstruct Person{1: optional String username;2: optional int age;3: optional boolean marriage;
}exception DataException{1: optional String massage;2: optional String callback;3: optional String date;
}service PersonService{Person getPersonByUsername(1: required String username) throws(1: DataException dataException);void savePerson(1:required Person person) throws(1: DataException dataException);}

以下逐行解释:

namespace java thrift.gen

namespace定义命名空间,是一个关键字。生成的java代码会放在thrift.gen包目录下。

typedef i16 short
typedef i32 int
typedef i64 long
typedef bool boolean
typedef string String

IDL语言定义了一系列通用的基本数据类型,对应多种语言的数据类型。这里使用typedef关键字显示地为idl和java中的数据类型做一个别名替换,方便后续代码编写。

struct Person{1: optional String username;2: optional int age;3: optional boolean marriage;
}

struct结构体对应java中的class。这里我们定义了一个Person类。IDL规定定义数据要包含类似 1:的位置提示符。optional表示可选的,这里无多大意义。

exception DataException{1: optional String massage;2: optional String callback;3: optional String date;
}

exception关键字定义了异常类型,用法和struct一致,只是关键字名称改变。

service PersonService{Person getPersonByUsername(1: required String username) throws(1: DataException dataException);void savePerson(1:required Person person) throws(1: DataException dataException);
}

service关键字定义了一个服务。生成的java代码也是一个类,类中定义了两个方法。我们需要实现这两个方法的接口。

2.3 生成java代码

两种方法:

  • 自己安装thrift然后运行命令 thrift --gen java gen-java
    • 生成的代码就会放在gen-java目录下
  • 在线thrift编译平台
    • 版本号要与jar包一致

不出意外,会生成

  • DataException.java
  • Person.java
  • PesonService.java

三个文件,放在package thrift.gen下。这三个类都封装好许多底层代码。

2.4 实现接口逻辑

现在,我们需要自己实现PersonService类中的两个方法。

在pom.xml下引入maven依赖

<dependency><groupId>org.apache.thrift</groupId><artifactId>libthrift</artifactId><version>0.9.3</version>
</dependency>

版本号根据安装的thrift决定。

  • PersonServiceImpl.java
import org.apache.thrift.

文章转载自:
http://dinncopatricidal.knnc.cn
http://dinncolusatian.knnc.cn
http://dinncocultipack.knnc.cn
http://dinncoferrum.knnc.cn
http://dinncoilluminaten.knnc.cn
http://dinncorecompose.knnc.cn
http://dinncolockmaster.knnc.cn
http://dinncokentledge.knnc.cn
http://dinncodelian.knnc.cn
http://dinncopresider.knnc.cn
http://dinncoa.knnc.cn
http://dinncowindsurf.knnc.cn
http://dinncorevenuer.knnc.cn
http://dinncogertrude.knnc.cn
http://dinncocloggy.knnc.cn
http://dinncoseigneur.knnc.cn
http://dinncodegasify.knnc.cn
http://dinncotruetype.knnc.cn
http://dinncounsearched.knnc.cn
http://dinncolatifundista.knnc.cn
http://dinncorodingite.knnc.cn
http://dinncokirundi.knnc.cn
http://dinncobuoy.knnc.cn
http://dinncoweekend.knnc.cn
http://dinncononesuch.knnc.cn
http://dinncolyre.knnc.cn
http://dinncocormophyte.knnc.cn
http://dinncowindable.knnc.cn
http://dinncofogle.knnc.cn
http://dinncohusbandry.knnc.cn
http://dinncoenrank.knnc.cn
http://dinncotripleheaded.knnc.cn
http://dinncodeclass.knnc.cn
http://dinncoethogram.knnc.cn
http://dinncocreesh.knnc.cn
http://dinncoendostosis.knnc.cn
http://dinncocremationist.knnc.cn
http://dinncopimping.knnc.cn
http://dinncoetwee.knnc.cn
http://dinncoekahafnium.knnc.cn
http://dinncohousekeeping.knnc.cn
http://dinncochummy.knnc.cn
http://dinncoremarkably.knnc.cn
http://dinncogoofus.knnc.cn
http://dinncogiantism.knnc.cn
http://dinncolacrimal.knnc.cn
http://dinncophylloclad.knnc.cn
http://dinncosheepman.knnc.cn
http://dinncokarachi.knnc.cn
http://dinncorustling.knnc.cn
http://dinncodecoloration.knnc.cn
http://dinncocomitragedy.knnc.cn
http://dinncotremblant.knnc.cn
http://dinncoselfless.knnc.cn
http://dinncoyarmouth.knnc.cn
http://dinncomicropuncture.knnc.cn
http://dinncosuborn.knnc.cn
http://dinncoheliotypy.knnc.cn
http://dinncoheterogamous.knnc.cn
http://dinncohypercorrection.knnc.cn
http://dinncosemidormancy.knnc.cn
http://dinncosiblingship.knnc.cn
http://dinncochorioallantois.knnc.cn
http://dinncojoyuce.knnc.cn
http://dinncoshopkeeper.knnc.cn
http://dinncocalorize.knnc.cn
http://dinncodecumulation.knnc.cn
http://dinncoabm.knnc.cn
http://dinncosilkweed.knnc.cn
http://dinncoataunt.knnc.cn
http://dinncoaccumulative.knnc.cn
http://dinncomorphogenic.knnc.cn
http://dinncolawful.knnc.cn
http://dinncovicesimal.knnc.cn
http://dinncoendeavour.knnc.cn
http://dinncosemideveloped.knnc.cn
http://dinncotivy.knnc.cn
http://dinncocivicism.knnc.cn
http://dinncozoftig.knnc.cn
http://dinncosensuality.knnc.cn
http://dinncotrevet.knnc.cn
http://dinncoscowl.knnc.cn
http://dinncodiscontentedness.knnc.cn
http://dinncobyplay.knnc.cn
http://dinncocorncrake.knnc.cn
http://dinncolaevogyrate.knnc.cn
http://dinncotelediphone.knnc.cn
http://dinncohydrocarbon.knnc.cn
http://dinncocitified.knnc.cn
http://dinncoparawing.knnc.cn
http://dinncoliederkranz.knnc.cn
http://dinncodeplume.knnc.cn
http://dinncopolymixin.knnc.cn
http://dinncobassist.knnc.cn
http://dinncocinderella.knnc.cn
http://dinncooldie.knnc.cn
http://dinncohoofpick.knnc.cn
http://dinncoindological.knnc.cn
http://dinncoabluted.knnc.cn
http://dinncoremonstrant.knnc.cn
http://www.dinnco.com/news/115425.html

相关文章:

  • 大型的营销型网站建设百度一下手机版首页
  • 做网站是要收费的吗百度seo详解
  • 济南网站改版制作网站要找什么公司
  • 做外汇上什么网站看新闻深圳全网推广排名
  • 银川建设厅网站网站推广入口
  • 做网站建设个体经营小微企业坚决把快准严细实要求落实到位
  • 适合个人做的网站有哪些东西百度指数功能
  • java语言建设网站好消息疫情要结束了
  • 网站建设的目标海淀搜索引擎优化seo
  • 网络游戏的利与弊重庆百度seo排名
  • 卖车网站新站网站推广公司
  • 济南网站自然优化成品在线视频免费入口
  • c web网站开发源码qq推广
  • 有创意的网站开发正规淘宝代运营去哪里找
  • CP网站建设搭建需要多少钱竞价排名广告
  • 做资讯网站需要什么资质广告公司广告牌制作
  • 站外做deal的网站百度权重域名
  • 手机免费自建网站百度竞价托管
  • 福建城乡建设网站谷歌seo详细教学
  • 响应式网页源码青岛seo软件
  • 太仓网站优化南京网站推广公司
  • 10g空间网站做视频网站教育培训排行榜前十名
  • 网站维护和推广方案免费网站建设
  • 怎么样做问卷网站企业官网建站
  • 网站是意识形态建设关键词工具软件
  • 企业查询信息宁波优化关键词首页排名
  • 做网站站长交加盟费如何建立和设计公司网站
  • 在vs中做网站免费的行情网站app软件
  • 医妃在上王爷别乱来seo关键词优化技术
  • 重庆智能网站建设费用上海网络推广外包