This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Lazy loading in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Lazy loading in servlet" Watch "Lazy loading in servlet" New topic
Author

Lazy loading in servlet

Abhijeet Sharma
Greenhorn

Joined: Sep 21, 2006
Posts: 4
Can anybody explain me what exactly is lazy loading in terms of servlet?

Thanks in advance,
Abhijeet
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

in what context?
Abhijeet Sharma
Greenhorn

Joined: Sep 21, 2006
Posts: 4
In context with servlet initialization ,A detailed explaination would be helpful..
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

lazy loading means that you don't load something at start up, you wait until it is required. When applied to servlets you get a servlet that is not loaded at start up, it loaded when it is required.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
A servlets when gets loaded with the first call , then its lazy loading.
Just do not put a load-on-start ,let the container load this on demand.


Rahul Bhattacharjee
LinkedIn - Blog
Abhijeet Sharma
Greenhorn

Joined: Sep 21, 2006
Posts: 4
Thanks david and rahul for the explaination..
I went through some links.. got another doubt on the same line..
what if i put <load-on-startup>0</load-on-startup> will this be invoed at starup up or on first request?
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
I think the value should be great that 0 and this is used for ordering of loading.May be you can do a quick check and let also know whats the result.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Abhijeet Sharma:
Thanks david and rahul for the explaination..
I went through some links.. got another doubt on the same line..
what if i put <load-on-startup>0</load-on-startup> will this be invoed at starup up or on first request?


Straight from the servlet spec:

The element load-on-startup indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the Web application. The element content of this element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-startup value.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

If you are writing servlets without having the Servlet Specification open on your desk, you're doing it wrong.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lazy loading in servlet
 
Similar Threads
hibernate mapping and performance
Hibernate objects into JComboBox
EJB lazy loading
Servlet Life Cycle doubt??
lazy loading