On 09/01/2010 11:01, Arnab Ghosh wrote:
>  Dear Friends,
> 
> Tomcat is using ManagerBase generateSessionId() to generate session Id. But
> I want a generation mechnism where each sessionId will be unique in whole
> tomcat. Right now it is unique in a single context. But I want uniqueness
> will be among all context running under the tomcat. How can I do that (In a
> easieast way)??

Do you understand what the odds are of generating a duplicated session?
Assuming the random number generator is a good one, if you had one
million current sessions in Tomcat, the odds of the next session being a
duplicate are one in 3.4E32.

If you were generating a thousand new sessions every second you would
see a duplicate on average every 1.1E22 years.

Even if the random number generator was terrible (it isn't) any only
generated 128 bits of randomness rather than 256 you would still only
see a duplicate on average every 580 years.

Even if my maths is off by a few orders of magnitude, I really don't
think this is an issue to worry about.

> Still now I have written a class which has extended the
> org.apache.session.standardManager class. Then I have changed the code
> slightly. But I don't know whether any sideeffect will be there or not??

It won't work in a clustered environment. Breaking scalability in this
way is a much bigger issue than the very rare chance of a duplicated
session.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to