servlet life cycle l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Servlet Life cycle PowerPoint Presentation
Download Presentation
Servlet Life cycle

Loading in 2 Seconds...

play fullscreen
1 / 9

Servlet Life cycle - PowerPoint PPT Presentation


  • 136 Views
  • Uploaded on

Servlet Life cycle. Bill Chu. Java. JAVA as an object oriented language Learned from experiences of other OO languages More completely defined library JAVA as a platform JAVA virtual machine (JVM) More completely defined run time environment “develop once, run everywhere” JVM

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Servlet Life cycle' - twyla


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2
Java
  • JAVA as an object oriented language
    • Learned from experiences of other OO languages
    • More completely defined library
  • JAVA as a platform
    • JAVA virtual machine (JVM)
    • More completely defined run time environment
    • “develop once, run everywhere”
  • JVM
    • Class loader
    • Byte code checker
    • Security Manager

© Bei-Tseng Chu Aug 2000

process and threads
Process and threads
  • Process: A program in execution. It consists of the executable program, the program’s run time status
    • Data
    • Stack
    • Program counter
    • Registers
  • Thread: a program in execution, but is part of a process. It consists of its own:
    • Stack
    • Program counter
    • Registers
    • Share data with other threads of the process

© Bei-Tseng Chu Aug 2000

contrast of process vs thread
Process

Takes more time to create

More secure

More fault tolerant

Thread

Takes less time to create

Offers multiple threads of execution

Share information with other threads

Less secure

More vulnerable to crashes

Contrast of process vs. thread

© Bei-Tseng Chu Aug 2000

jvm and servlets
JVM and servlets
  • UNC Charlotte server configuration
    • All servelets share the same JVM
    • Servelets are loaded when they are first called and stay loaded
    • Update to servelets needs to be reloaded
  • For production servers, servelets are often pre-loaded
  • Servelets can have dedicated JVM’s to help with reliability

© Bei-Tseng Chu Aug 2000

servelet life cycle
Servelet life cycle
  • Each servelet instance is loaded once
  • Each execution happens in a separate thread
  • Method init() is only called once during initialization of the servelet
  • Method service() is invoked every time a request comes it. It spawns off threads to perform doGet or doPost based on the method invoked
  • Method service should not be redefined
  • Method doGet and doPost typically need to do perform the same actions (p.36)

© Bei-Tseng Chu Aug 2000

data synchronization over multiple threads
Data synchronization over multiple threads
  • Consider the example of a shopping cart application implemented using a servelet.
  • Suppose one browser wants to bump the items ordered from 1 to 3
  • Suppose another browser wants to change the items ordered from 1 to 0
  • Suppose the submit buttons are pressed at exactly the same time
  • We cannot predict what would be the final number of items ordered

© Bei-Tseng Chu Aug 2000

single thread model servelet
Single thread model servelet
  • Single thread servelet is possible
  • It can avoid many of the data synchronization issues
  • However, it severely limits performance

© Bei-Tseng Chu Aug 2000

destroy method
destroy method
  • Before the servelet is removed, the destroy method is invoked
  • It can be used to “clean up” environments such as database connections.

© Bei-Tseng Chu Aug 2000