4 Replies Latest reply on Jul 12, 2008 7:58 PM by diegocoronel

    About ConversationIdGenerator

    diegocoronel

      Hi,


      I just wanna know if its secure create my own ConversationIdGenerator, my system will have almost 40 simultaneous users, and i think a unique generator id is really weird because its beeing so high....


      can anyone comment about my generator ? if is there any problem, pls.



      @BypassInterceptors
      @Name("org.jboss.seam.core.ConversationIdGenerator")
      @Scope(ScopeType.SESSION)
      @Install(precedence=Install.FRAMEWORK)
      public class IDoctorConversationIdGenerator extends ConversationIdGenerator {
           
          private AtomicInteger uniqueIDoctorId = new AtomicInteger(0);
      
          @Override
          public String getNextId() {
              //TODO: this is not cluster safe ?
              return Integer.toString(uniqueIDoctorId.incrementAndGet());
          }   
      
          public static ConversationIdGenerator instance() {
               IDoctorConversationIdGenerator instance = 
                  (IDoctorConversationIdGenerator) Component.getInstance("org.jboss.seam.core.ConversationIdGenerator");
              return (instance!=null) ? instance : new IDoctorConversationIdGenerator();
          }
           
      
      }
      



      I did a session id generator, and im using



      @BypassInterceptors



      because the seam default generator does not any injection, or seam generator does not have bypass because any other problem ?


      Sry about english, waiting all possible suggestions, ty !!! ;)

        • 1. Re: About ConversationIdGenerator
          pmuir

          Why do you want to create your own id generator that is almost identical to Seam's?

          • 2. Re: About ConversationIdGenerator
            diegocoronel

            Because ids are beeing really high, i dont know what happens, but for example, with 2 or 3 navigation my system is getting id  number 100, i cant find why this is happening, i found seam graphicImage calling generator lots of time, i saw viewId was null for this component, and i changed it to jsf graphicImage with seam id nested, this reduced my id lots, but its growning up really fast. And all my clients ask me why these numbers are so high, and solution i find was make this generator associated to session, probably im doing something wrong, do you think my generator can fail ?

            • 3. Re: About ConversationIdGenerator
              pmuir

              I don't see why it matters what the number is as conversations are isolated within the session anyway.


              But your solution is fine.

              • 4. Re: About ConversationIdGenerator
                diegocoronel

                Pete Muir wrote on Jul 12, 2008 19:51:


                I don't see why it matters what the number is as conversations are isolated within the session anyway.

                But your solution is fine.


                hum, if conversations are isolated from session and my generator init from 1 for each session, can i have problem if in 2 diferent sessions i get same conversation id ?