1 4 package com.tc.object.session; 5 6 import com.tc.util.sequence.Sequence; 7 8 public class SessionManagerImpl implements SessionManager, SessionProvider { 9 10 private final Sequence sequence; 11 private SessionID sessionID = SessionID.NULL_ID; 12 13 public SessionManagerImpl(Sequence sequence) { 14 this.sequence = sequence; 15 } 16 17 public synchronized SessionID getSessionID() { 18 return sessionID; 19 } 20 21 public synchronized void newSession() { 22 sessionID = new SessionID(sequence.next()); 23 } 24 25 public synchronized boolean isCurrentSession(SessionID compare) { 26 return sessionID.equals(compare); 27 } 28 29 public synchronized String toString() { 30 return getClass().getName() + "[current session=" + sessionID + "]"; 31 } 32 33 } 34 | Popular Tags |