Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.64 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What Causes A Conversation ID To Be Incremented
  2. public class ConversationIdGenerator implements Callable<String>, Serializable {
  3.  
  4.     public static final String CONVERSATION_ID_GENERATOR_ATTRIBUTE_NAME = ConversationIdGenerator.class.getName();
  5.  
  6.     private static final long serialVersionUID = 8489811313900825684L;
  7.  
  8.     // The next conversation ID
  9.     private final AtomicInteger id;
  10.  
  11.     /**
  12.      * Creates a new conversation ID generator
  13.      */
  14.     public ConversationIdGenerator() {
  15.         this.id = new AtomicInteger(1);
  16.     }
  17.  
  18.     public String call() {
  19.         int nextId = id.getAndIncrement();
  20.         return String.valueOf(nextId);
  21.     }
  22.  
  23. }