tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark H. Wood" <mw...@IUPUI.Edu>
Subject Re: Server.xml Sort on Start
Date Fri, 25 May 2007 13:42:55 GMT
On Thu, May 24, 2007 at 07:37:25PM -0700, Kyle B wrote:
> In regards to Mark's statement. I'm not opposed to writing some XML parsing
> tools to play nice with Tomcat. However, I'm still left trying to figure out
> how Tomcat sorts that HashMap it creates for all <Host> elements. I've
> looked for patterns that I just can't find. It's not sorted by element order
> in the server.xml, nor by name attribute, or appBase.

Given the information that hosts are collected in a HashMap: Tomcat
isn't sorting anything, and you can't sort a HashMap*.  Hashing
functions are designed to distribute a large key space over a much
smaller set of "buckets" in constant time.  The more apparently random
the relationship between input and output, the better for this
purpose, in most cases.  The entries in a hashtable are deliberately
DISordered on insertion.  Hashing data is like hashing meat and
potatoes: the result is expected to be finely divided and well mixed.

* You could sort its content into some other data structure, but apparently
  that's not done here.

Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Typically when a software vendor says that a product is "intuitive" he
means the exact opposite.

View raw message