Application (ServletContext) problem with load balancing

Source: Internet
Author: User

ServletContext translated as "Servletcontext ". is aservletwith theservletinterface for direct communication between containers. J2sdkeeof theJavadocsaid it was "a set of methods that a servlets uses to communicate with its servlet container."ServletThe container starts aWebwhen applied, it creates aServletContextobject. EachWebthe application has a uniqueServletContextobject. With oneWeball of the appsservletobject to share aServeltcontext. Servletobject can access various resources in the container through it.

in the program, you can put ServletContext understood as a package that holds global variables

ServletContextobject is contained in theServletConfigobject,ServletConfigobject is initialized in theServletwhen theWebserver is provided toServlet.

in theServletcontainer, eachServletContextThere is usually only one instance. WhenWebcontainers are distributed when deployed on multiple machines, the oneServletContextin eachJVMhas an instance on it.

ServletContextThe properties in the localJVMcan not be run in a distributed environment in otherJVMin theServletaccess, if you need to share data in a distributed environment, you can store the data inSession, the database orEJBthe.

in theServletcontainer, but no deployedServletis also permissible, thisServletbelongs to a defaultServletContext, this defaultServletContextcannot be distributed to multipleJVMon.

Web The server may support multiple domain names to share a IP address, this configuration is called a "virtual host." In this case, each virtual host must have its own ServletContextandcannot share a servletcontext.


Application (ServletContext) problem with load balancing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.