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

有哪些做数据分析的网站怎么做卖橘子的网站

有哪些做数据分析的网站,怎么做卖橘子的网站,营业执照注册,seo整站优化方案1. Reactor是什么 Reactor 是一个基于Reactive Streams规范的响应式编程框架。它提供了一组用于构建异步、事件驱动、响应式应用程序的工具和库。Reactor 的核心是 Flux#xff08;表示一个包含零到多个元素的异步序列#xff09;和 Mono表示一个包含零或一个元素的异步序列…1. Reactor是什么 Reactor 是一个基于Reactive Streams规范的响应式编程框架。它提供了一组用于构建异步、事件驱动、响应式应用程序的工具和库。Reactor 的核心是 Flux表示一个包含零到多个元素的异步序列和 Mono表示一个包含零或一个元素的异步序列。Reactor 通过提供响应式的操作符如map、filter、flatMap等使得开发者能够方便地进行数据流的转换和处理。 2. Reactor、Callback、CompletableFuture三种形式异步编码对比 编码简洁程度Reactor最优Reactor线程利用率最高因实现了Reactive Streams规范拥有背压事件驱动特性此处暂不展开) 代码如下 pom依赖 dependencyManagementdependenciesdependencygroupIdio.projectreactor/groupIdartifactIdreactor-bom/artifactIdversion2023.0.0/versiontypepom/typescopeimport/scope/dependency/dependencies /dependencyManagementdependenciesdependencygroupIdio.projectreactor/groupIdartifactIdreactor-core/artifactId/dependency /dependenciesCallback回调地狱 interface FirstCallback {void onCompleteFirst(String result);void onErrorFirst(Exception e); }interface SecondCallback {void onCompleteSecond(String result);void onErrorSecond(Exception e); }interface ThirdCallback {void onCompleteThird(String result);void onErrorThird(Exception e); }class AsyncOperations {static void firstOperation(FirstCallback firstCallback) {new Thread(() - {try {// 模拟异步操作Thread.sleep(2000);// 操作完成后调用回调函数firstCallback.onCompleteFirst(First operation completed);} catch (Exception e) {// 发生异常时调用错误回调firstCallback.onErrorFirst(e);}}).start();}static void secondOperation(String input, SecondCallback secondCallback) {new Thread(() - {try {// 模拟异步操作Thread.sleep(2000);// 操作完成后调用回调函数secondCallback.onCompleteSecond(Second operation completed with input: input);} catch (Exception e) {// 发生异常时调用错误回调secondCallback.onErrorSecond(e);}}).start();}static void thirdOperation(String input, ThirdCallback thirdCallback) {new Thread(() - {try {// 模拟异步操作Thread.sleep(2000);// 操作完成后调用回调函数thirdCallback.onCompleteThird(Third operation completed with input: input);} catch (Exception e) {// 发生异常时调用错误回调thirdCallback.onErrorThird(e);}}).start();} }public class CallbackHellExample {public static void main(String[] args) {AsyncOperations.firstOperation(new FirstCallback() {Overridepublic void onCompleteFirst(String result) {System.out.println(First Callback: result);// 第一次操作完成后调用第二次操作AsyncOperations.secondOperation(result, new SecondCallback() {Overridepublic void onCompleteSecond(String result) {System.out.println(Second Callback: result);// 第二次操作完成后调用第三次操作AsyncOperations.thirdOperation(result, new ThirdCallback() {Overridepublic void onCompleteThird(String result) {System.out.println(Third Callback: result);}Overridepublic void onErrorThird(Exception e) {System.out.println(Error in Third Callback: e.getMessage());}});}Overridepublic void onErrorSecond(Exception e) {System.out.println(Error in Second Callback: e.getMessage());}});}Overridepublic void onErrorFirst(Exception e) {System.out.println(Error in First Callback: e.getMessage());}});// 主线程继续执行其他操作System.out.println(Main thread continues...);} }CompletableFuture优化Callback回调地狱 public class CompletableFutureExample {public static void main(String[] args) {CompletableFutureString firstOperation CompletableFuture.supplyAsync(() - {try {// 模拟异步操作Thread.sleep(2000);return First operation completed;} catch (InterruptedException e) {throw new RuntimeException(e);}});CompletableFutureString secondOperation firstOperation.thenApplyAsync(result - {System.out.println(First CompletableFuture: result);try {// 模拟异步操作Thread.sleep(2000);return Second operation completed with input: result;} catch (InterruptedException e) {throw new RuntimeException(e);}});CompletableFutureString thirdOperation secondOperation.thenApplyAsync(result - {System.out.println(Second CompletableFuture: result);try {// 模拟异步操作Thread.sleep(2000);return Third operation completed with input: result;} catch (InterruptedException e) {throw new RuntimeException(e);}});thirdOperation.whenComplete((result, throwable) - {if (throwable null) {System.out.println(Third CompletableFuture: result);} else {System.out.println(Error in CompletableFuture: throwable.getMessage());}});// 主线程继续执行其他操作System.out.println(Main thread continues...);// 等待所有操作完成CompletableFuture.allOf(firstOperation, secondOperation, thirdOperation).join();} }Reactor优化Callback回调地狱 public class ReactorOptimizedExample {public static void main(String[] args) {Mono.fromCallable(() - {// 模拟异步操作Thread.sleep(2000);return First operation completed;}).subscribeOn(Schedulers.boundedElastic()).flatMap(result - {System.out.println(First Reactor: result);return Mono.fromCallable(() - {// 模拟异步操作Thread.sleep(2000);return Second operation completed with input: result;}).subscribeOn(Schedulers.boundedElastic());}).flatMap(result - {System.out.println(Second Reactor: result);return Mono.fromCallable(() - {// 模拟异步操作Thread.sleep(2000);return Third operation completed with input: result;}).subscribeOn(Schedulers.boundedElastic());}).doOnSuccess(result - System.out.println(Third Reactor: result)).doOnError(error - System.out.println(Error in Reactor: error.getMessage())).block(); // 阻塞等待操作完成// 主线程继续执行其他操作System.out.println(Main thread continues...);} }学习打卡Java学习笔记-day06-响应式编程Reactor优化Callback回调地狱
http://www.zqtcl.cn/news/895929/

相关文章:

  • 深圳做微信网站建设我爱水煮鱼 wordpress
  • 企业网站推广是不是必要的蓝色网站建设
  • 浙江企业响应式网站建设网站建设 找vx cp5173
  • nodejs做的网站音乐网站制作教程
  • 怎么利用网站做外链接阿里云网站部署
  • 做学校网站简述网站的制作步骤
  • 怎样让网站响应式推广策划案
  • 网站开发 面试 适当吹牛网站文件命名规则
  • 河北省建设中心网站图片分享网站源码
  • 工信部网站备案修改个人求职网站怎么做
  • 关于建设公司网站的申请宁波网站制作出售
  • 织梦电影网站免费模板网站域名asia是
  • 顺德中小企业网站建设宁乡市建设局网站
  • 静态网页模板 网站模板兰州做网站价格
  • 吕梁推广型网站建设godaddy托管 wordpress
  • 什么网站百度收录好珠海哪里做网站的
  • 如何介绍网站模板金融网站模版
  • 网站内链怎么优化e时代网站制作
  • 记事本做网站素材代码国内十大4a广告公司
  • 一米八效果图网站商业网站平台
  • 做搜狗手机网站优化产品推广计划怎么写
  • 网站链接优化怎么做ftp服务器
  • 什么网站可以接单做海报网站信息员队伍建设方案
  • 淘宝联盟 网站怎么做网站运营推广方案设计
  • 网站建设数据库类型百度seo现状
  • 德州网站优化公司平面设计公司企业logo设计
  • 山东平台网站建设价位网站广告文案
  • 可以做哪方面的网站万网董事长是谁
  • 京东网站开发费用程序员找工作的网站
  • 怎么做网站首页psdwordpress 注册验证