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

有哪个网站可以做ppt赚钱易网拓营销型网站

有哪个网站可以做ppt赚钱,易网拓营销型网站,网页设计实训总结三百字,天津市建设工程交易信息网在学习Zipkin分布式追踪系统中我们了解到Trace在整个调用链是一致的#xff0c;在web服务中可以通过在header设置Trace值在不同的服务中进行传递#xff0c;那样在一个服务内部不同的线程#xff0c;甚至是线程池中Zipkin是如何处理的#xff0c;接下来我们来了解学习一下。…在学习Zipkin分布式追踪系统中我们了解到Trace在整个调用链是一致的在web服务中可以通过在header设置Trace值在不同的服务中进行传递那样在一个服务内部不同的线程甚至是线程池中Zipkin是如何处理的接下来我们来了解学习一下。单个线程在单个线程的调用过程中我们一般都知道通过ThreadLocal来完成在整个线程执行过程中获取相同的Trace值Zipkin也是通过定义了一个ThreadLocal local来实现处理的。父子线程在主线程中新建立一个子线程时使用ThreadLocal就无效了因此Zipkin提供了如下定义方式使用InheritableThreadLocal定义(可以参考博客Java 多线程InheritableThreadLocal 实现原理)static final InheritableThreadLocal INHERITABLE new InheritableThreadLocal();这样就是存在父子线程在创建子线程的过程中会将父线程的值全部拷贝到子线程中这样在子线程中依然可以获取到Trace值因此如下面的代码追踪链路依然是完整的。RequestMapping(/start2)public String start(HttpServletRequest request1,HttpServletResponse response1) throws InterruptedException, IOException {Thread thread new Thread((new Runnable() {Overridepublic void run() {System.err.println(Thread.currentThread().hashCode());data restTemplate.getForObject(http://localhost:9090/foo, String.class);}}));thread.start();return data;}线程池在我们新创建一个线程然后将线程提交给线程池时由于线程池中线程执行的原理此时原线程中的ThreadLocal和InheritableThreadLocal都是无效的追踪Trace值因此会丢失导致整个调用链出现断路如下面代码。RequestMapping(/start2)public String start(HttpServletRequest request1,HttpServletResponse response1) throws InterruptedException, IOException {String data ;Thread thread new Thread((new Runnable() {Overridepublic void run() {System.err.println(Thread.currentThread().hashCode());data restTemplate.getForObject(http://localhost:9090/foo, String.class);}}));executor.execute(thread);Thread.sleep(10000);return data;}目前Zipkin类CurrentTraceContext给出对线程及线程池的的处理方法就是实现了Runnable重新实现了run方法这样就解决了线程池的问题当然不只提供了创建线程的方法还包括线程池和Callablepublic Runnable wrap(Runnable task) {//获取父线程中的Tracefinal TraceContext invocationContext get();class CurrentTraceContextRunnable implements Runnable {Override public void run() {//将父线程中的Trace复制到子线程中try (Scope scope maybeScope(invocationContext)) {task.run();}}}return new CurrentTraceContextRunnable();}public Scope maybeScope(Nullable TraceContext currentSpan) {TraceContext currentScope get();if (currentSpan null) {if (currentScope null) return Scope.NOOP;return newScope(null);}return currentSpan.equals(currentScope) ? Scope.NOOP : newScope(currentSpan);}public Executor executor(Executor delegate) {class CurrentTraceContextExecutor implements Executor {Override public void execute(Runnable task) {delegate.execute(CurrentTraceContext.this.wrap(task));}}return new CurrentTraceContextExecutor();}/*** Decorates the input such that the {link #get() current trace context} at the time a task is* scheduled is made current when the task is executed.*/public ExecutorService executorService(ExecutorService delegate) {class CurrentTraceContextExecutorService extends brave.internal.WrappingExecutorService {Override protected ExecutorService delegate() {return delegate;}Override protected Callable wrap(Callable task) {return CurrentTraceContext.this.wrap(task);}Override protected Runnable wrap(Runnable task) {return CurrentTraceContext.this.wrap(task);}}return new CurrentTraceContextExecutorService();}public Callable wrap(Callable task) {final TraceContext invocationContext get();class CurrentTraceContextCallable implements Callable {Override public C call() throws Exception {try (Scope scope maybeScope(invocationContext)) {return task.call();}}}return new CurrentTraceContextCallable();}
http://www.huolong8.cn/news/141493/

相关文章:

  • 百度网站推广怎么样广点通投放平台登录
  • 宁波专业网站推广平台咨询环球资源网成立时间
  • 中怎么做网站上下载图片的功能南昌外包建站
  • 制作商城网站西安官网seo收费
  • 巩义专业网站建设公司推荐.net开发的网站有哪些
  • 网站模板文件扫描win10部署wordpress
  • 网站关键词 查询制作网页需要用到哪些工具
  • 梅江区建设局网站做婚礼请柬的网站有哪些
  • 昆明做网站那家好古典网站建设
  • 会声会影模板免费网站seo技术分类
  • 专门做招商的网站是什么意思广州设计公司网站
  • 能绑定域名的免费网站安徽合肥做网站的公司有哪些
  • 学生做网站期末作业wordpress适合百度
  • WordPress建影视站十大网络营销经典案例
  • 网站建设视频教程网字节跳动现有员工人数
  • 计算机科学与技术 开题报告 网站建设医疗器械网上采购平台
  • 潍坊网站建设小程序php开发做网站
  • vs210做网站国内创意网页设计
  • 电话号码宣传广告汕头百度seo电话
  • 常州自助做网站wordpress建站博客
  • 移动网站的设计报告织梦的手机端网站模板下载地址
  • flask做视频网站广州百度seo
  • 百度做的网站 如果不做推广了 网站还保留吗国外flash网站模板
  • 网站空间换了 使用原有域名软文广告经典案例分析
  • 网站建设财务计划与预测小广告网页
  • 旅游网站建设解决方案重庆做网站推广
  • 对于政务网站建设的建议h5如何做多页面网站
  • 网站布局设计排版深圳龙岗房价
  • 百事企业的网站建设类型网站平台建设的作用
  • 苏州网站建设联系电话平度建设网站