/** * Finds an existing, non-expired {@link Session} by ID. * * If the {@link Session} is expired, then the {@link Session} is deleted and {@literal null} is returned. * * @param sessionId {@link String} containing the {@link Session#getId() ID}} of the {@link Session} to get. * @return an existing {@link Session} by ID or {@literal null} if no {@link Session} exists * or the {@link Session} expired. * @see AbstractGemFireOperationsSessionRepository.GemFireSession#from(Session) * @see org.springframework.session.Session * @see #commit(Session) * @see #configure(Session) * @see #delete(Session) * @see #registerInterest(Session) * @see #touch(Session) */ @Nullable public Session findById(String sessionId) { Session storedSession = getSessionsTemplate().get(sessionId); if (storedSession != null) { storedSession = storedSession.isExpired() ? delete(storedSession) : touch(commit(registerInterest(configure(GemFireSession.from(storedSession))))); } return storedSession; }