I need to replicate a sequence/counter across an eight node cluster. This means that each http request receives the next value in the sequence by calling something like getNextIntAndIncrement(), where the sequence state is synchronized across all servers. To clarify, this must exist at application/global scope, not session. I know it sounds like an awful idea and will undoubtably lead to bottlenecking but this is the requirement.
My question is what is the best solution? I've looked at stateful session beans, but they appear to be designed for only one client. I considered a database sequence. I've also looked at Terracotta clustering; they have a sequence demo http://www.terracotta.org/web/display/orgsite/Recipe?recipe=sequencer However I'd like to avoid third party solutions if a J2EE solution exists. I'm using Weblogic 8.1.