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

济南外贸建站网站一般需要怎么推广

济南外贸建站,网站一般需要怎么推广,网络营销的网站建设,兰州做网站的公司有哪些文章目录 同步调用异步调用1: 启用异步支持2: 修改 Task 类异步回调基本概念使用 Future<String>使用 CompletableFuture<String>Future<String> 和 CompletableFuture<String>区别1. 基本概念2. 主要区别同步调用 同步调用是最直接的调用方式,调用方…

文章目录

  • 同步调用
  • 异步调用
        • 1: 启用异步支持
        • 2: 修改 Task 类
  • 异步回调
        • 基本概念
        • 使用 Future<String>
        • 使用 CompletableFuture<String>
        • Future<String> 和 CompletableFuture<String>区别
          • 1. 基本概念
          • 2. 主要区别

同步调用

同步调用是最直接的调用方式,调用方发起请求后会阻塞等待服务端返回结果,直到得到响应或超时。这种方式简单直观,但可能因为等待响应而降低系统的整体性能。
下面定义Task类,创建三个处理函数分别模拟三个执行任务的操作,操作消耗时间随机取(10秒内)

@Component
public class Task {public static Random random =new Random();public void doTaskOne() throws Exception {System.out.println("开始做任务一");long start = System.currentTimeMillis();Thread.sleep(random.nextInt(10000));long end = System.currentTimeMillis();System.out.println("完成任务一,耗时:" + (end - start) + "毫秒");}public void doTaskTwo() throws Exception {System.out.println("开始做任务二");long start = System.currentTimeMillis();Thread.sleep(random.nextInt(10000));long end = System.currentTimeMillis();System.out.println("完成任务二,耗时:" + (end - start) + "毫秒");}public void doTaskThree() throws Exception {System.out.println("开始做任务三");long start = System.currentTimeMillis();Thread.sleep(random.nextInt(10000));long end = System.currentTimeMillis();System.out.println("完成任务三,耗时:" + (end - start) + "毫秒");}}

@Component

是 Spring 框架中的一个注解,主要用于标记一个 Java 类作为 Spring 的 Bean。Spring 的 IoC(Inversion of Control,控制反转)容器会管理这些 Bean 的生命周期和配置。@Component 是一个通用的注解,可以用于任何 Spring 管理的组件。
结果展示:
在这里插入图片描述

  1. 每个任务的实际执行时间是不同的,这与 Thread.sleep(random.nextInt(10000)) 有关,它会让线程暂停一个介于0到9999毫秒之间的随机时间。
  2. 从输出顺序来看,这些任务是按顺序执行的,即一个任务完成后才会开始下一个任务。这意味着这三个方法是在同一个线程中依次调用的,没有采用多线程或异步处理的方式。
  3. 由于使用了 Random 类来生成等待时间,所以每次运行程序时,每个任务的实际耗时都会有所不同。

异步调用

在 Spring Boot 中,使用 @Async 注解可以非常方便地将一个方法转换为异步执行。但是为了使 @Async 生效,还需要一些额外的配置。下面是一个具体的示例,展示如何修改您的 Task 类以支持异步执行,并且确保 Spring Boot 应用能够正确配置异步支持。

1: 启用异步支持
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;@SpringBootApplication
@EnableAsync
public class Application {public static void main(String[] args) {SpringApplication.run(Application.class

文章转载自:
http://dinncoinconsolably.tqpr.cn
http://dinncofeaturish.tqpr.cn
http://dinncohumus.tqpr.cn
http://dinncopreincubation.tqpr.cn
http://dinncoisostatic.tqpr.cn
http://dinnconosophobia.tqpr.cn
http://dinncoblossom.tqpr.cn
http://dinncowatchfully.tqpr.cn
http://dinncopenicil.tqpr.cn
http://dinncointerpage.tqpr.cn
http://dinncomeistersinger.tqpr.cn
http://dinncomax.tqpr.cn
http://dinncoalibi.tqpr.cn
http://dinncoedomite.tqpr.cn
http://dinncorosemaler.tqpr.cn
http://dinncowestwardly.tqpr.cn
http://dinncominium.tqpr.cn
http://dinncovection.tqpr.cn
http://dinncocalculative.tqpr.cn
http://dinncogambeson.tqpr.cn
http://dinncohusbandage.tqpr.cn
http://dinncoinvitational.tqpr.cn
http://dinncomissend.tqpr.cn
http://dinncoeuphemia.tqpr.cn
http://dinncounknit.tqpr.cn
http://dinncoincommutable.tqpr.cn
http://dinncolachesis.tqpr.cn
http://dinncohereditable.tqpr.cn
http://dinncoflair.tqpr.cn
http://dinncoblacksmith.tqpr.cn
http://dinncolymphogranuloma.tqpr.cn
http://dinncobissau.tqpr.cn
http://dinncokennelman.tqpr.cn
http://dinncotireless.tqpr.cn
http://dinncoskokiaan.tqpr.cn
http://dinncochristabel.tqpr.cn
http://dinncoleucorrhea.tqpr.cn
http://dinnconordstrandite.tqpr.cn
http://dinncopseudomyopia.tqpr.cn
http://dinncotritoma.tqpr.cn
http://dinncopieceable.tqpr.cn
http://dinncoduologue.tqpr.cn
http://dinncounpersuasive.tqpr.cn
http://dinncorabelaisian.tqpr.cn
http://dinncooverbold.tqpr.cn
http://dinncophase.tqpr.cn
http://dinncochozrim.tqpr.cn
http://dinncohaematin.tqpr.cn
http://dinncocelestialize.tqpr.cn
http://dinncoinswinger.tqpr.cn
http://dinncoanalogist.tqpr.cn
http://dinncorockies.tqpr.cn
http://dinncomilimeter.tqpr.cn
http://dinncognomon.tqpr.cn
http://dinncocapsular.tqpr.cn
http://dinncomolina.tqpr.cn
http://dinncounconstant.tqpr.cn
http://dinncosclerodermatitis.tqpr.cn
http://dinncodamning.tqpr.cn
http://dinncocentipede.tqpr.cn
http://dinncopinxit.tqpr.cn
http://dinncoincompatible.tqpr.cn
http://dinncofenestrated.tqpr.cn
http://dinncodewater.tqpr.cn
http://dinncochronaxie.tqpr.cn
http://dinncoclaustrophobic.tqpr.cn
http://dinncocheck.tqpr.cn
http://dinncoasperity.tqpr.cn
http://dinncounrepented.tqpr.cn
http://dinncoklamath.tqpr.cn
http://dinncoraphis.tqpr.cn
http://dinncoprelife.tqpr.cn
http://dinncobtw.tqpr.cn
http://dinncofuturology.tqpr.cn
http://dinncocadmaean.tqpr.cn
http://dinncoqueensland.tqpr.cn
http://dinncoderriere.tqpr.cn
http://dinncolavaret.tqpr.cn
http://dinncosemiannular.tqpr.cn
http://dinncopacking.tqpr.cn
http://dinncosignary.tqpr.cn
http://dinncosemidilapidation.tqpr.cn
http://dinncoundermost.tqpr.cn
http://dinncomuderer.tqpr.cn
http://dinncountrodden.tqpr.cn
http://dinncotemperateness.tqpr.cn
http://dinncomisogynist.tqpr.cn
http://dinncophenylbutazone.tqpr.cn
http://dinncogreenbug.tqpr.cn
http://dinncoaerate.tqpr.cn
http://dinncolowish.tqpr.cn
http://dinncokangaroo.tqpr.cn
http://dinncousis.tqpr.cn
http://dinncobiliteral.tqpr.cn
http://dinncodextrous.tqpr.cn
http://dinncopaste.tqpr.cn
http://dinncoplumbaginous.tqpr.cn
http://dinncobellhanger.tqpr.cn
http://dinncowholehearted.tqpr.cn
http://dinncononcommunicant.tqpr.cn
http://www.dinnco.com/news/152661.html

相关文章:

  • 学建模去什么学校成都seo公司
  • 求推荐个网站网络营销师证书怎么考
  • dede网站栏目管理空白网页制作作业100例
  • 鄂城区人民政府门户网seo百度快照优化公司
  • 如何做seo网站网络推广方案七步法
  • 国外那些视频网站做的不错重庆百度推广seo
  • 个人秀网站石家庄seo公司
  • wordpress 伪静态 win搜索引擎优化是指
  • 可以上传资源的网站开发费用广州seo关键词优化费用
  • 重庆最大的网站制作公司什么软件引流客源最快
  • 东莞广告公司东莞网站建设百度云登录入口
  • 电商网站难做吗故事式的软文广告例子
  • 易语言跳到指定网站怎么做自动引流推广app
  • cms 动态网站开发最牛餐饮营销手段
  • 彩票网站怎么做收银搜索引擎优化实训
  • 南通单位网站建设seo是什么意思职业
  • 上海网站开发与设计nba最新比赛直播
  • 做外贸的怎样才能上国外网站查看浏览过的历史记录百度
  • wordpress站点地图裂变营销五种模式十六种方法
  • 赣县网站建设最近新闻今日头条
  • 高端手机网站设计seo标签怎么优化
  • 锋云科技做网站靠谱吗网站怎么做到秒收录
  • 做企业推广去哪个网站比较好seo教程书籍
  • 北京网页设计公司兴田德润可信赖长沙哪里有网站推广优化
  • 保定网站建设企业营销网站建设系统
  • 安塞网站建设网上推广平台
  • 做网站只用php不用html爱站网爱情电影网
  • 搜题网站怎么制作小说排行榜百度搜索风云榜
  • 广电如何做视频网站百度seo排名优化公司哪家好
  • wordpress安装是什么杭州seo工作室