In what order are objects unbound when a session expires?

Alessandro A. Garbagnati


The order of the objects that are unbound when the session exires is, theoretically, unknown.

Mainly it depends how the servlet comntainer stores the attributes. Normally, the selection is a Hashtable or an unsorted collections, so the 'order' of the Enumeration that they use for removing them it's not guaranteed or defined.

I've checked Tomcat sources and they use an Hashtable, so when the expire() method is called, they get the Enumeration using getAttributeNames() and the remove the objects one by one.