Skip to main content

Container是如何工作的

huhxLess than 1 minute

Java web 应用通常会跑在 Container上面,比如人尽皆知的 Tomcat。下面我们来看下 Tomcat 是怎么工作的

工作流程

202403270918356240
202403270918356240
202403270920276841
202403270920276841
2024032709204302
2024032709204302
202403270921026543
202403270921026543
202403270921166004
202403270921166004
20240327092947556
20240327092947556

The servlet lifecycle is simple; there’s only one main state—initialized.If the servlet isn’t initialized, then it’s either being initialized (running its constructor or init()method), being destroyed (running its destroy() method), or it simply does not exist.

202403270931448417
202403270931448417

The Three Big Lifecycle Moments

202403270932137028
202403270932137028

The Container runs multiple threads to process multiple requests to a single servlet

202403270934049069
202403270934049069

Session与Context