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

网站开发中使用框架吗代做设计网站好

网站开发中使用框架吗,代做设计网站好,网络营销渠道管理,pc开奖网站建设前段时间同事问我#xff0c;我们录制的流量中#xff0c;尤其是dubbo的子调用显示经常他的末尾会带上一个小尾巴这个是什么意思呢#xff0c;其实之前我没有太在意这个事情#xff0c;只是同事这么疑问了#xff0c;确实激起了好奇心#xff0c;所以就差了下 到底是什么… 前段时间同事问我我们录制的流量中尤其是dubbo的子调用显示经常他的末尾会带上一个小尾巴这个是什么意思呢其实之前我没有太在意这个事情只是同事这么疑问了确实激起了好奇心所以就差了下 到底是什么 我们先看下是什么样的现象 如下图所示 如上 这里就会跟上一个~AP 的小尾巴那这个到底是什么意思呢是某个hash的结果吗要了解这个其实也不难我们就看下dubbo子调用的identity是怎么赋值的就好了。所以我们来看下具体的逻辑 在录制过程中事件过来的时候如果是Before的情况下就会进入如下内容 protected void doBefore(BeforeEvent event) throws ProcessControlException {// 回放流量如果是入口则放弃子调用则进行mockif (RepeatCache.isRepeatFlow(Tracer.getTraceId())) {processor.doMock(event, entrance, invokeType);return;}Invocation invocation initInvocation(event);invocation.setStart(System.currentTimeMillis());invocation.setTraceId(Tracer.getTraceId());invocation.setIndex(entrance ? 0 : SequenceGenerator.generate(Tracer.getTraceId()));invocation.setIdentity(processor.assembleIdentity(event));invocation.setEntrance(entrance);invocation.setType(invokeType);invocation.setProcessId(event.processId);invocation.setInvokeId(event.invokeId);invocation.setRequest(processor.assembleRequest(event));invocation.setResponse(processor.assembleResponse(event));invocation.setSerializeToken(ClassloaderBridge.instance().encode(event.javaClassLoader));try {// fix issue#14 : useGeneratedKeysif (processor.inTimeSerializeRequest(invocation, event)) {SerializerWrapper.inTimeSerialize(invocation);}} catch (SerializeException e) {Tracer.getContext().setSampled(false);log.error(Error occurred serialize, e);}RecordCache.cacheInvocation(event.invokeId, invocation); }所以identity 是经过各自的子调用处理器处理后生成的标识。这里我们具体的就是dubbo的调用所以我们看下 DubboConsumerInvocationProcessor 的逻辑 public Identity assembleIdentity(BeforeEvent event) {Object invoker;Object invocation;if (ON_RESPONSE.equals(event.javaMethodName)) {// for record identity assemble// onResponse(Result appResponse, Invoker? invoker, Invocation invocation) {}invoker event.argumentArray[1];invocation event.argumentArray[2];} else {// for repeater identity assemble// invoke(Invoker? invoker, Invocation invocation)invoker event.argumentArray[0];invocation event.argumentArray[1];}try {// methodNameString methodName (String) MethodUtils.invokeMethod(invocation, getMethodName);Class?[] parameterTypes (Class?[]) MethodUtils.invokeMethod(invocation, getParameterTypes);// interfaceNameString interfaceName ((Class)MethodUtils.invokeMethod(invoker, getInterface)).getCanonicalName();return new Identity(InvokeType.DUBBO.name(), interfaceName, getMethodDesc(methodName, parameterTypes), getExtra());} catch (Exception e) {// ignoreLogUtil.error(error occurred when assemble dubbo request, e);}return new Identity(InvokeType.DUBBO.name(), unknown, unknown, null); }我们看到Identity 直接就是通过 new Identity(InvokeType.DUBBO.name(), interfaceName, getMethodDesc(methodName, parameterTypes), getExtra()) 完成的。 所以这的参数按照前面截图的来看的话 InvokeType.DUBBO.name() 即 dubbo, interfaceName 则是 com.xx.xx.api.service.UserAgreementApiService getMethodDesc(methodName, parameterTypes) 这个看了下实现原来就是我们一直在寻找的带小尾巴的原因了 我们来看下。 protected String getMethodDesc(String methodName, Class?[] parameterTypes) {StringBuilder builder new StringBuilder(methodName);if (parameterTypes ! null parameterTypes.length 0) {builder.append(~);for (Class? parameterType : parameterTypes) {String className parameterType.getSimpleName();builder.append(className.subSequence(0, 1));}}return builder.toString();}我们可以看到它这里就是就是在拼接方法跟参数类型不过他没有拿参数类型的所有内容而是参数类型的类名比如说 Java.lang.String 结果就是string 了 然后取这里的第一个字符。 getExtra() 暂时位置看着是http的query的字段 不过看到所有的录制的子调用录制逻辑基本都是null, 我们这里暂时就先忽略了。 那我们就直接看下Identity 的构造函数是怎么样的吧。 public Identity(String scheme, String location, String endpoint, MapString, String extra) {this.scheme scheme;this.location location;this.endpoint endpoint;this.extra extra;StringBuilder sb new StringBuilder();sb.append(scheme).append(HOST_SPLITTER).append(Joiner.on(/).join(location, endpoint));if (extra ! null !extra.isEmpty()) {boolean firstKey true;for (Map.EntryString, String entry : extra.entrySet()) {if (firstKey) {firstKey false;sb.append(QUERY_STRING_COLLECTOR);} else {sb.append(KEY_VALUE_SPLITTER);}sb.append(entry.getKey()).append(KEY_VALUE_COLLECTOR).append(entry.getValue());}}this.uri sb.toString();}可以看到构造函数里面的逻辑其实重点是在构造一个uri, 而这个uri 应该就是我们最开始截图的时候看到的identity的内容了。 其实就是通过各个分隔符连接起来构成我们传参进来的数据。
http://www.w-s-a.com/news/258199/

相关文章:

  • 网站建设的税率WordPress多用户建站
  • 专业门户网站的规划与建设网络培训
  • 东莞汽车总站停止营业crm管理系统在线使用
  • 深圳网站建设公司哪个网络优化是做什么的
  • 大连地区做网站自己怎么做电影网站
  • 成都APP,微网站开发手机要访问国外网站如何做
  • 网站app建设用discuz做的手机网站
  • vs 2008网站做安装包公众号登录超时
  • 银川做网站推广wordpress dux会员中心
  • 双辽做网站wordpress怎么写html代码
  • 建站公司哪家好 知道万维科技西安都有哪些公司
  • 设计网站官网入口佛山 品牌设计
  • 专用网站建设wordpress mega
  • 网站建设与优化推广方案内容网站整站下载带数据库后台的方法
  • 做网站PAAS系统外链是什么意思
  • 网页设计专业设计课程googleseo排名公司
  • 网站百度百科那些免费网站可以做国外贸易
  • 做视频的网站有哪些南京计算机培训机构哪个最好
  • ppt做视频 模板下载网站商业街网站建设方案
  • 佛山网站定制开发星光影视园网站建设案例
  • wordpress子站点商务网页设计与制作微课版答案
  • 山东省住房城乡和建设厅网站软件开发主要几个步骤
  • 可以接项目做的网站网站源码php
  • 杭州广众建设工程有限公司网站网页游戏人气排行榜
  • 上海网站开发建设最简单的网站代码
  • 东莞做网站建设免费网站建设案例
  • 莱州建设局网站wordpress的主题下载地址
  • 二级网站域名长沙企业关键词优化服务质量
  • 在家有电脑怎么做网站wordpress 入门主题
  • 什邡建设局网站sem推广是什么意思