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

手机论坛网站怎么做网络营销概论

手机论坛网站怎么做,网络营销概论,wordpress幻灯片主题,商丘市做1企业网站的公司写在前面 spring boot 3 已经提供了对虚拟线程的支持。 虚拟线程和平台线程主要区别在于#xff0c;虚拟线程在运行周期内不依赖操作系统线程#xff1a;它们与硬件脱钩#xff0c;因此被称为 “虚拟”。这种解耦是由 JVM 提供的抽象层赋予的。 虚拟线程的运行成本远低于平…写在前面 spring boot 3 已经提供了对虚拟线程的支持。 虚拟线程和平台线程主要区别在于虚拟线程在运行周期内不依赖操作系统线程它们与硬件脱钩因此被称为 “虚拟”。这种解耦是由 JVM 提供的抽象层赋予的。 虚拟线程的运行成本远低于平台线程。消耗的内存要少得多。这就是为什么可以创建数百万个虚拟线程而不会出现内存不足的问题而标准平台或内核线程只能创建数百个。 虚拟线程会优先使用JVM提供如果不能使用JVM提供则考虑使用由平台线程支持的“虚拟线程” ,相关源代码参考java.lang.ThreadBuilders#newVirtualThread 版本要求 spring boot 3.2.0jdk 21 pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.2.0/versionrelativePath/ !-- lookup parent from repository --/parentgroupIdnet.jlxxw/groupIdartifactIdboot3-demo/artifactIdversion1.0.0.20231128/versionnameboot3-demo/namedescriptionboot3-demo/descriptionpropertiesjava.version21/java.versionproject.build.sourceEncodingUTF-8/project.build.sourceEncodingproject.reporting.outputEncodingUTF-8/project.reporting.outputEncodingspring-boot.version3.2.0/spring-boot.version/propertiesdependenciesdependencygroupIdorg.apache.httpcomponents.client5/groupIdartifactIdhttpclient5-fluent/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-aop/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-configuration-processor/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-logging/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency/dependenciesbuildpluginsplugingroupIdorg.graalvm.buildtools/groupIdartifactIdnative-maven-plugin/artifactIdconfiguration!-- imageName用于设置生成的二进制文件名称 --imageName${project.artifactId}/imageName!-- mainClass用于指定main方法类路径 --!-- buildArgs--!-- no-fallback--!-- /buildArgs--/configuration !-- executions-- !-- execution-- !-- idbuild-native/id-- !-- goals-- !-- goalcompile-no-fork/goal-- !-- /goals-- !-- phasepackage/phase-- !-- /execution-- !-- /executions--/pluginplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/build/project yml spring:#启动虚拟线程的必须配置threads:virtual:# 启用虚拟线程技术增加系统并发能力enabled: true自动装配解析 Tomcat 虚拟线程自动配置类 org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration.TomcatWebServerFactoryCustomizerConfiguration#tomcatVirtualThreadsProtocolHandlerCustomizer /** Copyright 2012-2023 the original author or authors.** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** https://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package org.springframework.boot.autoconfigure.web.embedded;import io.undertow.Undertow; import org.apache.catalina.startup.Tomcat; import org.apache.coyote.UpgradeProtocol; import org.eclipse.jetty.ee10.webapp.WebAppContext; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.Loader; import org.xnio.SslClientAuthMode; import reactor.netty.http.server.HttpServer;import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWarDeployment; import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.thread.Threading; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment;/*** {link EnableAutoConfiguration Auto-configuration} for embedded servlet and reactive* web servers customizations.** author Phillip Webb* since 2.0.0*/ AutoConfiguration ConditionalOnNotWarDeployment ConditionalOnWebApplication EnableConfigurationProperties(ServerProperties.class) public class EmbeddedWebServerFactoryCustomizerAutoConfiguration {/*** Nested configuration if Tomcat is being used.*/Configuration(proxyBeanMethods false)ConditionalOnClass({ Tomcat.class, UpgradeProtocol.class })public static class TomcatWebServerFactoryCustomizerConfiguration {Beanpublic TomcatWebServerFactoryCustomizer tomcatWebServerFactoryCustomizer(Environment environment,ServerProperties serverProperties) {return new TomcatWebServerFactoryCustomizer(environment, serverProperties);}BeanConditionalOnThreading(Threading.VIRTUAL)TomcatVirtualThreadsWebServerFactoryCustomizer tomcatVirtualThreadsProtocolHandlerCustomizer() {return new TomcatVirtualThreadsWebServerFactoryCustomizer();}}/*** Nested configuration if Jetty is being used.*/Configuration(proxyBeanMethods false)ConditionalOnClass({ Server.class, Loader.class, WebAppContext.class })public static class JettyWebServerFactoryCustomizerConfiguration {Beanpublic JettyWebServerFactoryCustomizer jettyWebServerFactoryCustomizer(Environment environment,ServerProperties serverProperties) {return new JettyWebServerFactoryCustomizer(environment, serverProperties);}BeanConditionalOnThreading(Threading.VIRTUAL)JettyVirtualThreadsWebServerFactoryCustomizer jettyVirtualThreadsWebServerFactoryCustomizer(ServerProperties serverProperties) {return new JettyVirtualThreadsWebServerFactoryCustomizer(serverProperties);}}/*** Nested configuration if Undertow is being used.*/Configuration(proxyBeanMethods false)ConditionalOnClass({ Undertow.class, SslClientAuthMode.class })public static class UndertowWebServerFactoryCustomizerConfiguration {Beanpublic UndertowWebServerFactoryCustomizer undertowWebServerFactoryCustomizer(Environment environment,ServerProperties serverProperties) {return new UndertowWebServerFactoryCustomizer(environment, serverProperties);}}/*** Nested configuration if Netty is being used.*/Configuration(proxyBeanMethods false)ConditionalOnClass(HttpServer.class)public static class NettyWebServerFactoryCustomizerConfiguration {Beanpublic NettyWebServerFactoryCustomizer nettyWebServerFactoryCustomizer(Environment environment,ServerProperties serverProperties) {return new NettyWebServerFactoryCustomizer(environment, serverProperties);}}} Tomcat虚拟线程定制器 org.springframework.boot.autoconfigure.web.embedded.TomcatVirtualThreadsWebServerFactoryCustomizer /** Copyright 2012-2023 the original author or authors.** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** https://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package org.springframework.boot.autoconfigure.web.embedded;import org.apache.coyote.ProtocolHandler; import org.apache.tomcat.util.threads.VirtualThreadExecutor;import org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.core.Ordered;/*** Activates {link VirtualThreadExecutor} on {link ProtocolHandler Tomcats protocol* handler}.** author Moritz Halbritter* since 3.2.0*/ public class TomcatVirtualThreadsWebServerFactoryCustomizerimplements WebServerFactoryCustomizerConfigurableTomcatWebServerFactory, Ordered {Overridepublic void customize(ConfigurableTomcatWebServerFactory factory) {factory.addProtocolHandlerCustomizers((protocolHandler) - protocolHandler.setExecutor(new VirtualThreadExecutor(tomcat-handler-)));}Overridepublic int getOrder() {return TomcatWebServerFactoryCustomizer.ORDER 1;}} 新的虚拟线程池 org.apache.tomcat.util.threads.VirtualThreadExecutor /** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with* this work for additional information regarding copyright ownership.* The ASF licenses this file to You under the Apache License, Version 2.0* (the License); you may not use this file except in compliance with* the License. You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/ package org.apache.tomcat.util.threads;import java.util.concurrent.Executor;import org.apache.tomcat.util.compat.JreCompat;/*** An executor that uses a new virtual thread for each task.*/ public class VirtualThreadExecutor implements Executor {private final JreCompat jreCompat JreCompat.getInstance();private Object threadBuilder;public VirtualThreadExecutor(String namePrefix) {threadBuilder jreCompat.createVirtualThreadBuilder(namePrefix);}Overridepublic void execute(Runnable command) {jreCompat.threadBuilderStart(threadBuilder, command);} }测试对比效果 启用虚拟线程 未启用虚拟线程
http://wiki.neutronadmin.com/news/322178/

相关文章:

  • 建筑常用的模板下载网站有哪些淘宝联盟优惠券网站建设
  • 加盟什么网站建设徐州网站建设求职简历
  • 做搜狗pc网站快速排幕墙设计培训乡网站建设
  • 上海市建设安装协会网站企业推广平台
  • 手机可以做网站的服务器吗iis 网站打不开
  • 黑白灰网站做网站注册页面模板
  • 服装网站建设策划书的基本结构wordpress页面无法编辑器
  • 自己做公众号和小说网站推广网站建设建设价格
  • 域名购买哪个网站最好如何推广短剧
  • 可做外链的网站北京价格网站建设
  • 郑州的建设网站有哪些不干胶印刷网站建设
  • 宁波网站建设设计公司排名网站建设青岛公司
  • 毕设网站建设如何做网站模板
  • 专业网站建设必要性从化低价网站建设
  • 上海网站开发公司app store官方正版下载
  • 网站域名备案需要什么慈溪市网站制作
  • 网站建设方案企业做网站用php还是html
  • 教育网站集群建设方案一级域名网站怎样收费的
  • 建设通网站怎么样建网站需要多少费用
  • 怎样从用户体现提高网站的搜索引擎信任度杭州营销型网站
  • 在线玩网页游戏h5网站大全母婴网站设计分析
  • 四川二级站seo整站优化排名网站死链排查
  • 阜南县城乡建设局官方网站广州市建筑集团有限公司官网
  • 做暧暧视频网站网络网站排名优化
  • 哪个软件做网站好网页版传奇霸主攻略
  • 湖北网站建站系统哪家好淮南市网站建设
  • 广东建设工程执业资格注册中心网站海南行指三亚网站开发
  • 怎么查网站外链数wordpress 4.9 优化
  • 旅游做的视频网站做最简单的网站
  • 西安机场商务宾馆百度做网站温州论坛吧