1 Reply Latest reply on Jan 21, 2009 9:55 AM by Andre Ehrlich

    Sequence ID generator - Advice sought

    Bernard Chan Newbie

      Hello,

      I'm pretty new to Java EE myself so bear with me and rectify my misunderstandings. I would like to create a component that returns a unique sequence ID, that increments upon each call. As this is just one of the business functionality exposed to Web tier, later on I would like to have the Java EE server hosting those services to be replicated or clustered, so I thought implementing it as an EJB (EJB3) may be suitable to reserve this possibility. Is this a sound choice, otherwise what kind of an architecture do you suggest for this scenario?

      The desired behaviour is:

      * Scalable (say, through replication) with high availability
      * The counter that keeps track of largest seq no. should be persistent (across AS or server shutdown) and should not lose state (no two seq no. ever returned should be identical) at any time
      * It seems keeping the counter in database is an overkill (I've tried something similar in the past with some other language and I agree that is not performing well) and I would like the counter persisted in some other way

      Any suggestions for me? I intend to deploy on JBoss 4.2.3, JDK6. Thank you.