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

网站建设相关业务网站建设实训总结300

网站建设相关业务,网站建设实训总结300,担保公司网站建设方案,昆明网络推广哪里有jd19支持虚拟线程#xff0c;虚拟线程是轻量级的线程#xff0c;它们不与操作系统线程绑定#xff0c;而是由 JVM 来管理。它们适用于“每个请求一个线程”的编程风格#xff0c;同时没有操作系统线程的限制。我们能够创建数以百万计的虚拟线程而不会影响吞吐。 做个 spri…jd19支持虚拟线程虚拟线程是轻量级的线程它们不与操作系统线程绑定而是由 JVM 来管理。它们适用于“每个请求一个线程”的编程风格同时没有操作系统线程的限制。我们能够创建数以百万计的虚拟线程而不会影响吞吐。 做个 springboot demo 尝试一下。 环境 jdk19gradle 7.6.1IntelliJ IDEA 2022.2.4 build.gradle plugins {id javaid org.springframework.boot version 3.0.3id io.spring.dependency-management version 1.1.0 }group com.example version 0.0.1-SNAPSHOT sourceCompatibility 19configurations {compileOnly {extendsFrom annotationProcessor} }repositories {mavenCentral() }dependencies {implementation org.springframework.boot:spring-boot-startercompileOnly org.projectlombok:lombokdevelopmentOnly org.springframework.boot:spring-boot-devtoolsannotationProcessor org.projectlombok:lomboktestImplementation org.springframework.boot:spring-boot-starter-test }tasks.named(test) {useJUnitPlatform() }tasks.withType(JavaCompile) {options.compilerArgs --enable-preview } 多线程demo 写一段多线程调用的代码程序入口 package com.example.myvirtualthreaddemo;import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.core.task.support.TaskExecutorAdapter; import org.springframework.scheduling.annotation.EnableAsync;import java.util.concurrent.Executors;EnableAsync SpringBootApplication public class MyVirtualThreadDemoApplication {public static void main(String[] args) {SpringApplication.run(MyVirtualThreadDemoApplication.class, args);}BeanCommandLineRunner commandLineRunner(AsyncService asyncService){return args - {for(int i 0; i 100; i){asyncService.fun(i);}};} } package com.example.myvirtualthreaddemo;import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service;Service Slf4j public class AsyncService {Asyncpublic void fun(int i) {log.info(fun:{}, i);} }运行结果使用平台线程默认8个 使用虚拟线程 在MyVirtualThreadDemoApplication添加以下代码块 Bean(TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME)public AsyncTaskExecutor asyncTaskExecutor(){return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor());}运行结果使用虚拟线程 遇到的一些问题 请使用 --enable-preview 以启用预览 API 解决办法 build.gradle里添加以下配置 tasks.withType(JavaCompile) {options.compilerArgs --enable-preview }设置vm选项如图
http://www.dnsts.com.cn/news/162794.html

相关文章:

  • 做个电商网站需要怎么做龙游建设工程信息网站
  • 网站后台功能开发wordpress切换div组件
  • 重庆市建设公共资源交易中心网站首页初创公司 建网站
  • 通化建设工程信息网站单页设计模板
  • 架设网站服务器优化大师官方免费下载
  • 备案的域名拿来做别的网站西宁贴吧
  • 莞城微信网站建设百度首页广告多少钱
  • 临汾推广型网站建设自己架服务器做网站
  • 网站免费模块营销手机都有什么功能啊
  • 怎样做分销网站wordpress 树形主题
  • 泉州(晋江)网站建设学校网站策划书
  • 专业设计服务网站网站收录怎么设置
  • 宝塔怎么做第二个网站影视小程序搭建教程
  • 一般做门户网站多少钱win优化大师
  • 衡水做网站建设滨海做网站需要多少钱
  • 网站页面描述WordPress中子项目怎么添加
  • 网站宣传和推广的方法有哪些案例展示在网站中的作用
  • 漯河网站建设兼职呼和浩特整站优化
  • 用软件什么做网站东营会计信息网官网
  • 郏县网站制作公司赛尔网络公司好不好
  • 南宁商城网站推广公司什么网站做美式软装设计理念
  • 网站建设的方案书整合营销传播的定义
  • 网站用什么技术实现系统集成项目管理
  • 外贸网址建站百度seo优化培训
  • 南通网站建设费用猪八戒建站服务
  • 毕业设计做网站用什么软件后端开发培训机构
  • 为什么网站不见了网站psd下载
  • 提供网站建设定制html的网页代码
  • 全包网站做阿胶上什么网站比较好
  • 网站的组织与风格设计wordpress文字主题