一个 servlet容器自己处理并发访问的问题

解决方案 »

  1.   

    当然不是, 可以生成多个instance的, 标准并没有限制容器提供商的具体实现。如果想保证thread safe,你自己加一个宣称 Interface javax.servlet.SingleThreadModel 这样的话容器就不会用同一个instance供多个thread使用!
      

  2.   

    首先SERVLET不是容器!TO:(Blueion)
    SERVLET 会被编译成JSP在客户端运行!
    所以 有几个请求就有几个INSTANCE!
      

  3.   

    支持gameboy999(-'_'-)!aasunboaa() ,不要胡说八道!
      

  4.   

    只有一个instance,如果宣称 Interface javax.servlet.SingleThreadModel,那同一个时刻就只能为一个用户提供服务,这就不存在同步的问题。如果并发,有要同步的地方,要自己保证。
      

  5.   

    一个实例,启动多个线程来响应请求。
    看看servlet specification不就完了。
    lz很懒
      

  6.   

    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.
    In the case where a servlet was deployed as part of an application ed in
    the deployment descriptor as distributable, a container may have only one instance
    per servlet declaration per virtual machine (VM). However, if the servlet in a distributable
    application implements the SingleThreadModel interface, the container
    may instantiate multiple instances of that servlet in each VM of the container.