Re: [JSP ] 請問JSP生命週期與全域變數問題
※ 引述《NewSpec (新規格)》之銘言:
: 大家好, 小弟有幾個問題想請教
: 1. JSP所translate出來, 用以實際render網頁輸出的servlet實體
: 在web container中的數量與存活時間大概是多久?
: 我找了好一陣子, 都沒有找到什麼相關資料
: 我想當然一定是implementation dependent的
: 但還是想看看有沒有什麼確切的資料或文獻可以佐證的~
: 例如如果同時有m個request進來的話, JSP servlet會產生n個實體
: 在t時間內如果沒有其他request發生, 該n個實體會被清除掉這樣.
其實這種問題查JSR最快, 下列取自JSR-315 Java Servlet Specification 3.0
Servlet生命週期
2.3.4 End of Service
The servlet container is not required to keep a servlet loaded for
any particular period of time. A servlet instance may be kept active
in a servlet container for a period of milliseconds, for the lifetime
of the servlet container (which could be a number of days, months, or years),
or any amount of time in between.
...
Servlet Instance數量
2.2 Number of Instances
...
For a servlet not hosted in a distributed environment (the default),
the servlet container must use only one instance per servlet declaration.
However, for a servlet implementing the SingleThreadModel interface,
the servlet container may instantiate multiple instances to handle
a heavy request load and serialize requests to a particular instance.
...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.172.169.128
→
10/22 18:53, , 1F
10/22 18:53, 1F
→
10/22 19:28, , 2F
10/22 19:28, 2F
推
10/22 22:59, , 3F
10/22 22:59, 3F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 4 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章