看板 java 關於我們 聯絡資訊
※ 引述《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
phstudy:Servlet 3.1也適用 10/22 18:53
NewSpec:thanks! 這真毫無疑問了! 10/22 19:28
LaPass:CONFIRMED! 流言證實! 10/22 22:59