Code example for AtomicLong

Methods: getAndIncrement

0
        this.sessions.put( session.getId(), session );
        return session;
    } 
     
    protected String getNextSessionId() {
        return "session-" + this.counter.getAndIncrement();
    } 
     
    private AtomicLong counter = new AtomicLong();
    private Map<String, SimpleStompSession> sessions = new HashMap<String,SimpleStompSession>();
 
}