Re: Load on startup 0

2004-05-14 Thread Jeanfrancois Arcand


Shapira, Yoav wrote:

Hi,
The spec is conflicting.  We've been telling people to simply not use 0 at all, as different containers handle it differently: use 1 for the first load-on-startup servlet, and -1 (or omit the element altogether) if you don't want it started when the server starts.  I suggest sending the JSR 154 folks a note asking for clarification in the next specification version.
 

I've passed the info to the spec lead. Let see

-- Jeanfrancois


Yoav Shapira
Millennium Research Informatics
 

-Original Message-
From: Remy Maucherat [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 7:28 AM
To: Tomcat Developers List
Subject: Load on startup 0
Hi,

I got a question recently on the load on startup behavior, when
associated to the 0 value. Tomcat will start those servlets last, and
this was done on purpose (this dates back from TC 4.0, I think).
However, the current spec wording isn't clear at all:


The load-on-startup element indicates that this
servlet should be loaded (instantiated and have
its init() called) on the startup of the web
application. The optional contents of these
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-start-up value.


The load-on-startup element indicates that this servlet should be
loaded on the startup of the web application.
The optional contents of these element must be a positive integer
indicating the order in which the servlet should be loaded.
Lower integers are loaded before higher integers.
If no value is specified, or if the value specified is not a positive
integer, the container is free to load it at any time in the startup
sequence.

Since 0 doesn't seem to be considered as a "positive integer", this
would mean our behavior is ok (somehow), but I'm really not sure ;)
Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   





This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged.  This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender.  Thank you.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Load on startup 0

2004-05-14 Thread Shapira, Yoav

Hi,
The spec is conflicting.  We've been telling people to simply not use 0 at all, as 
different containers handle it differently: use 1 for the first load-on-startup 
servlet, and -1 (or omit the element altogether) if you don't want it started when the 
server starts.  I suggest sending the JSR 154 folks a note asking for clarification in 
the next specification version.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Remy Maucherat [mailto:[EMAIL PROTECTED]
>Sent: Friday, May 14, 2004 7:28 AM
>To: Tomcat Developers List
>Subject: Load on startup 0
>
>Hi,
>
>I got a question recently on the load on startup behavior, when
>associated to the 0 value. Tomcat will start those servlets last, and
>this was done on purpose (this dates back from TC 4.0, I think).
>
>However, the current spec wording isn't clear at all:
>
>
>The load-on-startup element indicates that this
>servlet should be loaded (instantiated and have
>its init() called) on the startup of the web
>application. The optional contents of these
>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-start-up value.
>
>
>
>The load-on-startup element indicates that this servlet should be
>loaded on the startup of the web application.
>The optional contents of these element must be a positive integer
>indicating the order in which the servlet should be loaded.
>Lower integers are loaded before higher integers.
>If no value is specified, or if the value specified is not a positive
>integer, the container is free to load it at any time in the startup
>sequence.
>
>
>Since 0 doesn't seem to be considered as a "positive integer", this
>would mean our behavior is ok (somehow), but I'm really not sure ;)
>
>Rémy
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Load on startup 0

2004-05-14 Thread Remy Maucherat
Hi,

I got a question recently on the load on startup behavior, when 
associated to the 0 value. Tomcat will start those servlets last, and 
this was done on purpose (this dates back from TC 4.0, I think).

However, the current spec wording isn't clear at all:


The load-on-startup element indicates that this
servlet should be loaded (instantiated and have
its init() called) on the startup of the web
application. The optional contents of these
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-start-up value.


The load-on-startup element indicates that this servlet should be
loaded on the startup of the web application.
The optional contents of these element must be a positive integer
indicating the order in which the servlet should be loaded.
Lower integers are loaded before higher integers.
If no value is specified, or if the value specified is not a positive
integer, the container is free to load it at any time in the startup
sequence.

Since 0 doesn't seem to be considered as a "positive integer", this 
would mean our behavior is ok (somehow), but I'm really not sure ;)

Rémy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Behaviour of load-on-startup=0

2004-03-08 Thread Shapira, Yoav

Hi,

>Load on startup should really be deprecated because it duplicates
>functionality available via context event listeners.

I wouldn't rush to this conclusion at all.  The Servlet's init and
destroy methods are the appropriate place to configure the servlet.

>As a warning, there is some variance in servlet engines. The spec says
0
>starts before 1, logically -1 should load before 0. In fact, some
>containers (like Websphere if I remember correctly) don't process
>entries with a value less than 0.

Yes, there is some variance as you say, but the spec as quoted by Senor
Prescott is clear and doesn't follow your "logically" statement above.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Behaviour of load-on-startup=0

2004-03-08 Thread George Sexton
Load on startup should really be deprecated because it duplicates
functionality available via context event listeners.

As a warning, there is some variance in servlet engines. The spec says 0
starts before 1, logically -1 should load before 0. In fact, some
containers (like Websphere if I remember correctly) don't process
entries with a value less than 0.

My practical advice to you is to look at context event listeners.

-Original Message-
From: Michael Prescott [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 08, 2004 10:44 AM
To: [EMAIL PROTECTED]
Subject: Behaviour of load-on-startup=0


I stumbled on what I think is a small difference in Tomcat's behaviour
from
the Servlet spec.  Looking at the code, it seems to affect both Tomcat 4
and
5.

In short, the servlet specs (2.3 and 2.4) says that a servlet with
 value set to 0 should load before those with values of
1
or higher, but Tomcat loads 1+ first, and 0 last.

"The load-on-startup element indicates that this servlet should be
loaded
(instantiated and have its init() called) on the startup of the web
application. The optional contents of these 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-start-up value."

Here's the first part of loadOnStartup(Container[]). This code is
identical
in Tomcat 4.x (StandardContext.java:3398) and 5.x
(StandardContext.java:3930).

public void loadOnStartup(Container children[]) {

  // Collect "load on startup" servlets that need to be initialized
  TreeMap map = new TreeMap();
  for (int i = 0; i < children.length; i++) {
Wrapper wrapper = (Wrapper) children[i];
int loadOnStartup = wrapper.getLoadOnStartup();
if (loadOnStartup < 0)
continue;
if (loadOnStartup == 0) // Arbitrarily put them last
loadOnStartup = Integer.MAX_VALUE;
Integer key = new Integer(loadOnStartup);
ArrayList list = (ArrayList) map.get(key);
if (list == null) {
list = new ArrayList();
map.put(key, list);
}
list.add(wrapper);
  }
...

It appears the problem would be solved by deleting the lines that read:

if (loadOnStartup == 0) // Arbitrarily put them last
  loadOnStartup = Integer.MAX_VALUE;

Michael

--
Michael Prescott
Ingenura Inc.
[EMAIL PROTECTED]
(416) 686-8576
PGP Public Key: http://www.ingenura.com/keys/MichaelPrescott.asc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Behaviour of load-on-startup=0

2004-03-08 Thread Michael Prescott
I stumbled on what I think is a small difference in Tomcat's behaviour from
the Servlet spec.  Looking at the code, it seems to affect both Tomcat 4 and
5.

In short, the servlet specs (2.3 and 2.4) says that a servlet with
 value set to 0 should load before those with values of 1
or higher, but Tomcat loads 1+ first, and 0 last.

"The load-on-startup element indicates that this servlet should be loaded
(instantiated and have its init() called) on the startup of the web
application. The optional contents of these 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-start-up value."

Here's the first part of loadOnStartup(Container[]). This code is identical
in Tomcat 4.x (StandardContext.java:3398) and 5.x
(StandardContext.java:3930).

public void loadOnStartup(Container children[]) {

  // Collect "load on startup" servlets that need to be initialized
  TreeMap map = new TreeMap();
  for (int i = 0; i < children.length; i++) {
Wrapper wrapper = (Wrapper) children[i];
int loadOnStartup = wrapper.getLoadOnStartup();
if (loadOnStartup < 0)
continue;
if (loadOnStartup == 0) // Arbitrarily put them last
loadOnStartup = Integer.MAX_VALUE;
Integer key = new Integer(loadOnStartup);
ArrayList list = (ArrayList) map.get(key);
if (list == null) {
list = new ArrayList();
map.put(key, list);
}
list.add(wrapper);
  }
...

It appears the problem would be solved by deleting the lines that read:

if (loadOnStartup == 0) // Arbitrarily put them last
  loadOnStartup = Integer.MAX_VALUE;

Michael

--
Michael Prescott
Ingenura Inc.
[EMAIL PROTECTED]
(416) 686-8576
PGP Public Key: http://www.ingenura.com/keys/MichaelPrescott.asc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]