servlet tomcat
在spring-mvc demo程序运行到DispatcherServlet的mvc处理 一文中,我们实践了浏览器输入一个请求,然后到SpringMvc的DispatcherServlet
处理的整个流程. 设计上这些都是tomcat servlet的处理
那么究竟这是怎么到DispatcherServlet处理的,本文将给出。
目录
- Tomcat架构
- Connector
- Http11NioProtocol -> NioEndpoint
- 接收tcp/ip请求的线程,Acceptor
- 处理socket连接数据的线程,Poller
- socket具体的读写处理,Processor(Executor线程池)
- 具体在抽象类AbstractEndpoint中org.apache.tomcat.util.net.AbstractEndpoint#processSocket
Tomcat架构
显然需要先了解tomcat, 可以下载tomcat源码分析。 其处理流程基本如下:
Tomcat包含几个容器:Engine, Host, Context,Wrapper,Servlet,最后是Servlet实例执行service
方法处理请求。
而Servlet 生命周期可被定义为从创建直到毁灭的整个过程。以下是 Servlet 遵循的过程:
- Servlet 通过调用
init()
方法进行初始化。 - Servlet 调用
service()
方法来处理客户端的请求。 - Servlet 通过调用
destroy()
方法终止(结束)。 - 最后,Servlet 是由 JVM 的垃圾回收器进行垃圾回收的。
service()
方法是执行实际任务的主要方法。Servlet 容器(即 Web 服务器)调用 service()
方法来处理来自客户端(浏览器)的请求,并把格式化的响应写回给客户端。每次服务器接收到一个 Servlet 请求时,服务器会产生一个新的线程并调用服务。service()
方法检查 HTTP 请求类型(GET、POST、PUT、DELETE 等),并在适当的时候调用 doGet
、doPost
、doPut
,doDelete
等方法。
Connector
connector是什么?
The HTTP Connector element represents a Connector component that supports the HTTP/1.1 protocol. It enables Catalina to function as a stand-alone web server, in addition to its ability to execute servlets and JSP pages. A particular instance of this component listens for connections on a specific TCP port number on the server.One or more such Connectors can be configured as part of a single Service, each forwarding to the associated Engine to perform request processing and create the response.
(https://tomcat.apache.org/tomcat-8.0-doc/config/http.html)
HTTP Connector 能支持 HTTP/1.1 协议。它使 Catalina 能够作为独立的 Web 服务器运行,此外还能够执行 servlet 和 JSP 页面。此组件的特定实例会侦听服务器上特定 TCP 端口号上的连接。可以将一个或多个这样的 Connector 配置为单个服务的一部分,每个 Connector 都会转发到关联的 Engine 以执行请求处理并创建响应。
public Connector(String protocol) {setProtocol(protocol);// Instantiate protocol handlerProtocolHandler p = null;try {Class<?> clazz = Class.forName(protocolHandlerClassName);p = (ProtocolHandler) clazz.getConstructor().newInstance();} catch (Exception e) {log.error(sm.getString("coyoteConnector.protocolHandlerInstantiationFailed"), e);} finally {this.protocolHandler = p;}if (Globals.STRICT_SERVLET_COMPLIANCE) {uriCharset = StandardCharsets.ISO_8859_1;} else {uriCharset = StandardCharsets.UTF_8;}// Default for Connector depends on this (deprecated) system propertyif (Boolean.parseBoolean(System.getProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "false"))) {encodedSolidusHandling = EncodedSolidusHandling.DECODE;}}
第一句 setProtocol就根据配置了socket编程协议类型
/*** Set the Coyote protocol which will be used by the connector.** @param protocol The Coyote protocol name** @deprecated Will be removed in Tomcat 9. Protocol must be configured via* the constructor*/@Deprecatedpublic void setProtocol(String protocol) {boolean aprConnector = AprLifecycleListener.isAprAvailable() &&AprLifecycleListener.getUseAprConnector();if ("HTTP/1.1".equals(protocol) || protocol == null) {if (aprConnector) {setProtocolHandlerClassName("org.apache.coyote.http11.Http11AprProtocol");} else {setProtocolHandlerClassName("org.apache.coyote.http11.Http11NioProtocol");}} else if ("AJP/1.3".equals(protocol)) {if (aprConnector) {setProtocolHandlerClassName("org.apache.coyote.ajp.AjpAprProtocol");} else {setProtocolHandlerClassName("org.apache.coyote.ajp.AjpNioProtocol");}} else {setProtocolHandlerClassName(protocol);}}
Http11NioProtocol -> NioEndpoint
接收tcp/ip请求的线程,Acceptor
protected final void startAcceptorThreads() {int count = getAcceptorThreadCount();acceptors = new Acceptor[count];for (int i = 0; i < count; i++) {acceptors[i] = createAcceptor();String threadName = getName() + "-Acceptor-" + i;acceptors[i].setThreadName(threadName);Thread t = new Thread(acceptors[i], threadName);t.setPriority(getAcceptorThreadPriority());t.setDaemon(getDaemon());t.start();}
}
直接:java.nio.channels.ServerSocketChannel#accept
(所以时刻都要知道socket编程和tcp协议,IO基础可复习:https://doctording.blog.csdn.net/article/details/145839941)
/**
* The background thread that listens for incoming TCP/IP connections and
* hands them off to an appropriate processor.
*/
protected class Acceptor extends AbstractEndpoint.Acceptor {@Override
public void run() {int errorDelay = 0;// Loop until we receive a shutdown commandwhile (running) {// Loop if endpoint is pausedwhile (paused && running) {state = AcceptorState.PAUSED;try {Thread.sleep(50);} catch (InterruptedException e) {// Ignore}}if (!running) {break;}state = AcceptorState.RUNNING;try {//if we have reached max connections, waitcountUpOrAwaitConnection();SocketChannel socket = null;try {// Accept the next incoming connection from the server// socketsocket = serverSock.accept();} catch (IOException ioe) {// We didn't get a socketcountDownConnection();if (running) {// Introduce delay if necessaryerrorDelay = handleExceptionWithDelay(errorDelay);// re-throwthrow ioe;} else {break;}}// Successful accept, reset the error delayerrorDelay = 0;// Configure the socketif (running && !paused) {// setSocketOptions() will hand the socket off to// an appropriate processor if successfulif (!setSocketOptions(socket)) {closeSocket(socket);}} else {closeSocket(socket);}} catch (Throwable t) {ExceptionUtils.handleThrowable(t);log.error(sm.getString("endpoint.accept.fail"), t);}}state = AcceptorState.ENDED;
}
处理socket连接数据的线程,Poller
Acceptor的到的连接socket,进行如下处理
/**
* Process the specified connection.
* @param socket The socket channel
* @return <code>true</code> if the socket was correctly configured
* and processing may continue, <code>false</code> if the socket needs to be
* close immediately
*/
protected boolean setSocketOptions(SocketChannel socket) {// Process the connectiontry {//disable blocking, APR style, we are gonna be polling itsocket.configureBlocking(false);Socket sock = socket.socket();socketProperties.setProperties(sock);NioChannel channel = nioChannels.pop();if (channel == null) {SocketBufferHandler bufhandler = new SocketBufferHandler(socketProperties.getAppReadBufSize(),socketProperties.getAppWriteBufSize(),socketProperties.getDirectBuffer());if (isSSLEnabled()) {channel = new SecureNioChannel(socket, bufhandler, selectorPool, this);} else {channel = new NioChannel(socket, bufhandler);}} else {channel.setIOChannel(socket);channel.reset();}getPoller0().register(channel);} catch (Throwable t) {ExceptionUtils.handleThrowable(t);try {log.error("",t);} catch (Throwable tt) {ExceptionUtils.handleThrowable(tt);}// Tell to close the socketreturn false;}return true;
}
Pollor类定义如下:
Pollor负责轮询网络连接上的数据。在 NIO 或 NIO2 模型中,Poller 线程会检查注册在其上的 Channel(例如,SocketChannel)是否有数据可读或可写。
其中使用了java nio的Selector,即允许一个单一的线程来操作多个 Channel.
/*** Poller class.*/
public class Poller implements Runnable {private Selector selector;private final SynchronizedQueue<PollerEvent> events =new SynchronizedQueue<>();private volatile boolean close = false;private long nextExpiration = 0;//optimize expiration handlingprivate AtomicLong wakeupCounter = new AtomicLong(0);private volatile int keyCount = 0;public Poller() throws IOException {this.selector = Selector.open();}
socket具体的读写处理,Processor(Executor线程池)
Poller判断连接是否有读写,交给Processor具体处理
protected void processKey(SelectionKey sk, NioSocketWrapper attachment) {try {if ( close ) {cancelledKey(sk);} else if ( sk.isValid() && attachment != null ) {if (sk.isReadable() || sk.isWritable() ) {if ( attachment.getSendfileData() != null ) {processSendfile(sk,attachment, false);} else {unreg(sk, attachment, sk.readyOps());boolean closeSocket = false;// Read goes before writeif (sk.isReadable()) {if (!processSocket(attachment, SocketEvent.OPEN_READ, true)) {closeSocket = true;}}if (!closeSocket && sk.isWritable()) {if (!processSocket(attachment, SocketEvent.OPEN_WRITE, true)) {closeSocket = true;}}if (closeSocket) {cancelledKey(sk);}}}} else {//invalid keycancelledKey(sk);}} catch ( CancelledKeyException ckx ) {cancelledKey(sk);} catch (Throwable t) {ExceptionUtils.handleThrowable(t);log.error("",t);}
}
背后是扩展的Executor线程池处理
/*** This class is the equivalent of the Worker, but will simply use in an* external Executor thread pool.*/protected class SocketProcessor extends SocketProcessorBase<NioChannel> {public SocketProcessor(SocketWrapperBase<NioChannel> socketWrapper, SocketEvent event) {super(socketWrapper, event);}@Overrideprotected void doRun() {NioChannel socket = socketWrapper.getSocket();SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());try {int handshake = -1;try {if (key != null) {if (socket.isHandshakeComplete()) {// No TLS handshaking required. Let the handler// process this socket / event combination.handshake = 0;} else if (event == SocketEvent.STOP || event == SocketEvent.DISCONNECT ||event == SocketEvent.ERROR) {// Unable to complete the TLS handshake. Treat it as// if the handshake failed.handshake = -1;} else {handshake = socket.handshake(key.isReadable(), key.isWritable());// The handshake process reads/writes from/to the// socket. status may therefore be OPEN_WRITE once// the handshake completes. However, the handshake// happens when the socket is opened so the status// must always be OPEN_READ after it completes. It// is OK to always set this as it is only used if// the handshake completes.event = SocketEvent.OPEN_READ;}}} catch (IOException x) {handshake = -1;if (log.isDebugEnabled()) log.debug("Error during SSL handshake",x);} catch (CancelledKeyException ckx) {handshake = -1;}if (handshake == 0) {SocketState state = SocketState.OPEN;// Process the request from this socketif (event == null) {state = getHandler().process(socketWrapper, SocketEvent.OPEN_READ);} else {state = getHandler().process(socketWrapper, event);}if (state == SocketState.CLOSED) {close(socket, key);}} else if (handshake == -1 ) {getHandler().process(socketWrapper, SocketEvent.CONNECT_FAIL);close(socket, key);} else if (handshake == SelectionKey.OP_READ){socketWrapper.registerReadInterest();} else if (handshake == SelectionKey.OP_WRITE){socketWrapper.registerWriteInterest();}} catch (CancelledKeyException cx) {socket.getPoller().cancelledKey(key);} catch (VirtualMachineError vme) {ExceptionUtils.handleThrowable(vme);} catch (Throwable t) {log.error("", t);socket.getPoller().cancelledKey(key);} finally {socketWrapper = null;event = null;//return to cacheif (running && !paused) {processorCache.push(this);}}}}
具体在抽象类AbstractEndpoint中org.apache.tomcat.util.net.AbstractEndpoint#processSocket
/*** Process the given SocketWrapper with the given status. Used to trigger* processing as if the Poller (for those endpoints that have one)* selected the socket.** @param socketWrapper The socket wrapper to process* @param event The socket event to be processed* @param dispatch Should the processing be performed on a new* container thread** @return if processing was triggered successfully*/
public boolean processSocket(SocketWrapperBase<S> socketWrapper,SocketEvent event, boolean dispatch) {try {if (socketWrapper == null) {return false;}SocketProcessorBase<S> sc = processorCache.pop();if (sc == null) {sc = createSocketProcessor(socketWrapper, event);} else {sc.reset(socketWrapper, event);}Executor executor = getExecutor();if (dispatch && executor != null) {executor.execute(sc);} else {sc.run();}} catch (RejectedExecutionException ree) {getLog().warn(sm.getString("endpoint.executor.fail", socketWrapper) , ree);return false;} catch (Throwable t) {ExceptionUtils.handleThrowable(t);// This means we got an OOM or similar creating a thread, or that// the pool and its queue are fullgetLog().error(sm.getString("endpoint.process.fail"), t);return false;}return true;
}
(可能不同版本不一样,如上是在tomcat-8.5.57源码中)
相关文章:
servlet tomcat
在spring-mvc demo程序运行到DispatcherServlet的mvc处理 一文中,我们实践了浏览器输入一个请求,然后到SpringMvc的DispatcherServlet处理的整个流程. 设计上这些都是tomcat servlet的处理 那么究竟这是怎么到DispatcherServlet处理的,本文将…...
在 Ubuntu 系统 22.04 上安装 Docker
在 Ubuntu 系统 22.04 上安装 Docker 在 Ubuntu 系统 22.04 上安装 Docker1. 更新系统包2. 安装依赖工具3. 添加 Docker 官方 GPG 密钥4. 添加 Docker 的 APT 仓库5. 安装 Docker Engine6. 启动并设置 Docker 服务7. 验证安装8. 配置非 Root 用户权限(可选…...
一分钟理解Mybatis 里面的缓存机制
MyBatis 是一个流行的 Java 持久层框架,它简化了数据库操作。MyBatis 提供了强大的缓存机制,用于提升性能,减少数据库的访问次数。MyBatis 的缓存机制分为一级缓存和二级缓存。 该图展示了用户通过 SqlSession 发起查询请求,…...
【我的Android进阶之旅】如何使用NanoHttpd在Android端快速部署一个HTTP服务器?
文章目录 开篇:程序员的"摸鱼神器"?一、为什么选择NanoHttpd?二、五分钟极速上车指南2.1 ▶ 第一步:引入依赖的哲学2.2 ▶ 第二步:创建服务器类:继承大法好2.3 ▶ 第三步:启动服务的仪式感三、高级玩法:让服务器不再单调3.1 🔥 场景1:变身文件服务器3.2 �…...
PyCharm 无法识别 Conda 环境的解决方案
一、问题分析 当在最新版 PyCharm (2024.3) 中配置 Conda 环境时,可能会出现以下典型错误: 找不到 Conda 可执行文件 我在网上找了很多解决办法,都没有有效解决这个问题,包括将环境路径替换为 .bat 文件和查找 python.exe 文件…...
AutoGen学习笔记系列(一)Tutorial - Model
这个系列文章记录了学习微软 AutoGen 的过程,与 smolagents 学习笔记系列一样,仍然以官方教程自己的理解为主线,中间可能穿插几个番外支线的形式写博客。 【注意】:在阅读这篇文章之前需要确保已经按照其 Installation 小节完成必…...
利用Git和wget批量下载网页数据
一、Git的下载(参考文章) 二. wget下载(网上很多链接) 三、git和wget结合使用 1.先建立一个文本,将代码写入文本(代码如下),将txt后缀改为sh(download_ssebop.sh…...
多线程JUC(一)
目录 前言一、多线程的三种实现方式1.继承Thread类2.实现Runnable接口3.利用Callable接口和Future接口4.三种方式对比 二、常见的成员方法1.getName、setName、currentThread、sleep2.线程的优先级3.守护线程4.插入线程 三、线程安全1.线程的生命周期2.同步代码块3.同步方法4.l…...
夸父工具箱(安卓版) 手机超强工具箱
如今,人们的互联网活动日益频繁,导致手机内存即便频繁清理,也会莫名其妙地迅速填满,许多无用的垃圾信息悄然占据空间。那么,如何有效应对这一难题呢?答案就是今天新推出的这款工具软件,它能从根…...
2025系统架构师(一考就过):案例之五:典型架构、架构演化、人工智能、云计算、大数据
六、中间件技术、典型架构 ◆中间件:在一个分布式系统环境中处于操作系统和应用程序之间的软件,可以在不同的技术之间共享资源,将不同的操作系统、数据库、异构的网络环境以及若干应用结合成一个有机的协同工作整体。 ◆中间件位于客户机/服务器的操作系…...
【随手笔记】利尔达NB模组
1.名称 移芯EC6263GPP 参数 指令备注 利尔达上电输出 [2025-03-04 10:24:21.379] I_AT_WAIT:i_len2 [2025-03-04 10:24:21.724] LI_AT_WAIT:i_len16 [2025-03-04 10:24:21.724] [2025-03-04 10:24:21.733] Lierda [2025-03-04 10:24:21.733] [2025-03-04 10:24:21.745] OK移…...
Mybatis 中#{} 和${} 的区别是什么?
在 MyBatis 中,#{} 和 ${} 都是用于动态 SQL 语句中的占位符,但是它们的作用和使用方式是不同的。下面是它们的区别: 1. #{} —— 用于防止 SQL 注入和自动类型处理 #{} 是用来将参数安全地传递到 SQL 语句中,它会将传递的参数值…...
nginx+keepalived负载均衡及高可用
1 项目背景 keepalived除了能够管理LVS软件外,还可以作为其他服务的高可用解决方案软件。采用nginxkeepalived,它是一个高性能的服务器高可用或者热备解决方案,Keepalived主要来防止服务器单点故障的发生问题,可以通过其与Nginx的…...
数据结构理论
目录 基本概念和术语 数据 数据元素 数据项 数据对象 数据结构 数据的结构 逻辑结构 存储结构(物理结构) 数据类型 定义 原子数据类型 结构数据类型 抽象数据类型(Abstract Data Type,ADT) 算法和算法分…...
【心得】一文梳理高频面试题 HTTP 1.0/HTTP 1.1/HTTP 2.0/HTTP 3.0的区别并附加记忆方法
面试时很容易遇到的一个问题—— HTTP 1.0/HTTP 1.1/HTTP 2.0/HTTP 3.0的区别,其实这四个版本的发展实际上是一环扣一环的,是逐步完善的,本文希望帮助读者梳理清楚各个版本之间的区别,并且给出当前各个版本的应用情况,…...
在Spring Boot项目中导出复杂对象到Excel文件
在Spring Boot项目中导出复杂对象到Excel文件,可以利用Hutool或EasyExcel等库来简化操作。这里我们将详细介绍如何使用Hutool和EasyExcel两种方式来实现这一功能。 使用Hutool导出复杂对象到Excel 首先确保你的pom.xml中添加了Hutool的依赖: <depe…...
spark 常见操作命令
配置虚拟机 配置即让自己的虚拟机可以联网,和别的虚拟机通讯 一、配置vm虚拟机网段。 具体设置为:虚拟机左上角点击编辑→虚拟网络编辑器 选择VMnet8, 要改动两个地方(注意:它会需要管理员权限ÿ…...
深入理解设计模式中的工厂模式(Factory Pattern)
各类资料学习下载合集 https://pan.quark.cn/s/8c91ccb5a474 工厂模式是创建对象的一种设计模式,属于创建型设计模式。它提供了一种方法来创建对象,而无需在代码中直接指定对象的具体类。工厂模式通过将对象的创建过程封装起来,使得代码更加灵活、可维护…...
DPDK网络开发
DPDK(Data Plane Development Kit)是一个用于快速数据包处理的开源库,广泛应用于高性能网络应用开发。 环境准备 硬件要求 NIC(网络接口卡):支持DPDK的网卡,如Intel的82599、X710等。 CPU&am…...
第三节:基于Winform框架的串口助手小项目---串口操作《C#编程》
知识是无尽的宝藏,学习的过程虽有挑战,但每一次突破都是对自我的升华,向着更优秀的自己全力进发。 -----------WHAPPY 本节将重点介绍,如何修改控件的属性、SerialPort类的使用及实现串口初始化的操作 1.修改控件属性 修改属性…...
机器学习核函数
在机器学习中,核函数(Kernel Function)是一个非常重要的概念,特别是在支持向量机(SVM)等算法中有着广泛的应用。下面从定义、作用、常见的核函数类型、工作原理等方面详细介绍: 定义࿱…...
linux中使用firewall命令操作端口
一、开放端口 1. 开放一个端口 sudo firewall-cmd --zonepublic --add-port8443/tcp --permanent sudo firewall-cmd --reload 2. 开放一组连续端口 sudo firewall-cmd --zonepublic --add-port100-500/tcp --permanent sudo firewall-cmd --reload 3. 一次开放多个不连续…...
【金融量化】Ptrade中的基础交易与高级量化交易策略的下单接口
1 基础交易与订单管理接口 1. order 功能:用于按指定数量买卖股票或其他金融产品。 参数: security:股票代码(字符串类型)。amount:交易数量(整数类型),正数表示买入&…...
解决docker认证问题 failed to authorize: failed to fetch oauth token
报错信息[bash1]解决方案 全局代理打开“buildkit”: false ,见[图1] [bash1] >docker build -t ffpg . [] Building 71.8s (3/3) FINISHED docker:desktop-linux> [internal] load bui…...
从“人力投放”到“智能战争”,谁能抢占先机?
流量成本飙升、用户行为碎片化、广告创意同质化……传统网络推广模式正面临失效危机。而AI技术的爆发,正在彻底改写游戏规则。小马识途营销顾问解析:“AI如何颠覆网络推广逻辑?企业又该如何借势破局?” 一、精准营销:…...
STM32_IIC外设工作流程
STM32 IC 外设工作流程(基于寄存器) 在 STM32 中,IC 通信主要通过一系列寄存器控制。理解这些寄存器的作用,能够帮助我们掌握 IC 硬件的运行机制,实现高效的数据传输。本文以 STM32F1(如 STM32F103&#x…...
Python 爬取唐诗宋词三百首
你可以使用 requests 和 BeautifulSoup 来爬取《唐诗三百首》和《宋词三百首》的数据。以下是一个基本的 Python 爬虫示例,它从 中华诗词网 或类似的网站获取数据并保存为 JSON 文件。 import requests from bs4 import BeautifulSoup import json import time# 爬取…...
浅浅初识AI、AI大模型、AGI
前记:这里只是简单了解,后面有时间会专门来扩展和深入。 当前,人工智能(AI)及其细分领域(如AI算法工程师、自然语言处理NLP、通用人工智能AGI)的就业前景呈现高速增长态势,市场需求…...
Spring40种注解(下)!!
Spring Bean 注解 ComponentScan ComponentScan注解用于配置Spring需要扫描的被组件注解注释的类所在的包。 可以通过配置其basePackages属性或者value属性来配置需要扫描的包路径。value属性是basePackages的别名。 Component Component注解用于标注一个普通的组件类&#…...
DeepSeek 系列模型:论文精读《A Survey of DeepSeek Models》
引言:一篇快速了解 DeepSeek 系列的论文。我在翻译时加入了一些可以提高 “可读性” 的连词 ✅ NLP 研 2 选手的学习笔记 笔者简介:Wang Linyong,NPU,2023级,计算机技术 研究方向:文本生成、大语言模型 论文…...
LeetCode hot 100—环形链表 II
题目 给定一个链表的头节点 head ,返回链表开始入环的第一个节点。 如果链表无环,则返回 null。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部…...
【AI】【Unity】关于Unity接入DeepseekAPI遇到的坑
前言 由于deepseek网页端在白天日常抽风,无法正常的使用,所以调用API就成了目前最好的选择,尤其是Deepseek的API价格低得可怕,这不是和白送的一样吗!然后使用过很多本地部署接入API的方式,例如Chatbox、Pa…...
计算机视觉算法实战——医学影像分割(主页有源码)
✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连✨ 1. 领域简介✨✨ 医学影像分割是计算机视觉在医疗领域的重要应用,旨在从CT、MRI、X光等医学图像中精确分割出目标区域&…...
51单片机——存储类型
主要内容:区分data,bdata,idata,pdata,xdata,code 8051系列单片机存储器结构的特点:ROM和RAM独立编址 8051系列单片机将程序存储器(ROM)和数据存储器(RAM)分开,并有各自的寻址机构和寻址方式。…...
python19-if和match的美
课程:B站大学 记录python学习,直到学会基本的爬虫,使用python搭建接口自动化测试就算学会了,在进阶webui自动化,app自动化 分支语句那些事儿 if 条件判断if...else 判断语句if...elif...else 多重条件分支嵌套也能在 e…...
期权有哪些用处?期权和期货比优势在哪?
期权如同金融市场的“瑞士军刀”,既能防御风险,又能主动出击。相较于期货的“刚性对决”,期权更像“柔性博弈”——通过策略组合在不确定性中捕捉确定性收益。 期权有哪些用处? 期权的核心价值在于其非对称性——买方风险有限&am…...
【html期末作业网页设计】
html期末作业网页设计 作者有话说项目功能介绍 网站结构完整代码网站样图 作者有话说 目前,我们的项目已经搭建了各页面的基本框架,但内容填充还不完善,各页面之间的跳转逻辑也还需要进一步优化。 我们深知,一个好的项目需要不断…...
ComfyUI AnimeDiff动画参数总结
ComfyUI AnimeDiff动画参数总结 一、动画生成核心参数 参数名称建议值/范围作用说明备注步数(Steps)15-25控制AI计算迭代次数,越高细节越精细,但耗时更长推荐20步,显存不足可降至15步CFG值7.0-8.5提示词对画面的控制…...
基于Three.js的多视图3D Tiles同步可视化技术解析
文章目录 基于Three.js的多视图3D Tiles同步可视化技术解析一、技术背景与价值二、核心实现原理2.1 视口分割算法2.2 视角同步机制三、关键代码解析3.1 渲染管线优化3.2 3D Tiles加载四、交互系统实现4.1 多视图事件分发4.2 射线拾取优化五、性能优化方案5.1 渲染性能指标5.2 W…...
7、什么是死锁,如何避免死锁?【高频】
(1)什么是死锁: 死锁 是指在两个或多个进程的执行时,每个进程都持有资源,并都在等待其他进程 释放 它所需的资源,如果此时所有的进程一直占有资源而不释放,就导致了死锁。 死锁只有同时满足 四…...
自动化学习-使用git进行版本管理
目录 一、为什么要学习git 二、git是什么 三、git如何使用 1、git的下载安装和配置 2、git常用的命令 3、gitee远程仓库的使用 (1)注册 (2)创建仓库 (3)配置公钥(建立电脑和git…...
前端大文件上传
一、切片上传技术原理 切片上传是把大文件分割成多个较小的切片,分别上传这些切片,最后在服务器端将它们合并成完整文件。这种方式能有效应对网络不稳定导致的上传失败问题,还可利用多线程并行上传,提升上传效率。 二、前端实现…...
【网络】实现电脑与笔记本电脑之间的直接网络连接
要实现电脑与笔记本电脑之间的直接网络连接,可以通过有线或无线两种方式。以下是详细的步骤指南: 一、有线直连(通过网线) 1. 准备工具 网线:使用交叉网线(适用于旧设备)或普通直连网线&#…...
“深入浅出”系列之音视频开发:(12)使用FFmpeg实现倍速播放:技术细节与优化思路
一、前言 在音视频处理领域,倍速播放是一个常见的需求,尤其是在视频播放器、在线教育平台等场景中,用户常常需要以不同的速度播放视频内容。然而,实现一个高质量的倍速播放功能并不容易,尤其是在处理音频时࿰…...
qt作业day2
1:在注册登录的练习里面,追加一个QListWidget 项目列表 要求:点击注册之后,将账号显示到 listWidget上面去 以及,在listWidget中双击某个账号的时候,将该账号删除 .h #ifndef WIDGET_H #define WIDGET_H …...
Qt:day1
一、作业 写1个Widget窗口,窗口里面放1个按钮,按钮随便叫什么; 创建2个Widget对象: Widget w1, w2; w1.show(); w2不管; 要求: 点击 w1.btn,w1隐藏,w2显示; 点击 w2.btn&…...
基于微信小程序的停车场管理系统的设计与实现
第1章 绪论 1.1 课题背景 随着移动互联形式的不断发展,各行各业都在摸索移动互联对本行业的改变,不断的尝试开发出适合于本行业或者本公司的APP。但是这样一来用户的手机上就需要安装各种软件,但是APP作为一个只为某个公司服务的一个软件&a…...
详细Linux基础知识(不断完善)
终端类型分类 1. 物理终端 直接连接到计算机的硬件设备2. 虚拟终端 通过快捷键切换的文本模式界面: Ctrl + Alt + F1 # 登录窗口 Ctrl + Alt + F2 # 当前图形界面 Ctrl + Alt + F3 # 虚拟命令终端 Ctrl + Alt + F4-F6 # 备用虚拟终端3. 图形终端 模拟终端:图形环境中的…...
类和对象-继承-C++
1.定义 面向对象的三大特征之一,为了减少重复的代码 2.语法 class 子类 :继承方式 父类 (子类也叫派生类,父类也称为基类) 例:class age:public person; #include<iostrea…...
初阶数据结构(C语言实现)——3顺序表和链表(1)
目录 【本节目标】1. 线性表2.顺序表2.1概念及结构2.2 接口实现2.2.0 动态顺序表2.2.1 顺序表初始化SLInit()2.2.2 销毁和打印2.2.3 尾插SLPushBack()2.2.4 尾删SLPopBack()2.2.5 头插2.2.6 头删2.2.7 插入…...