SessionRepository.save returns S

Issue gh-809
This commit is contained in:
Rob Winch
2017-06-22 17:30:40 -05:00
parent 233d179bfa
commit cd8686ae9c
5 changed files with 9 additions and 5 deletions

View File

@@ -76,8 +76,9 @@ public class MapSessionRepository implements SessionRepository<Session> {
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
}
public void save(Session session) {
public Session save(Session session) {
this.sessions.put(session.getId(), new MapSession(session));
return session;
}
public Session getSession(String id) {

View File

@@ -52,7 +52,7 @@ public interface SessionRepository<S extends Session> {
*
* @param session the {@link Session} to save
*/
void save(S session);
S save(S session);
/**
* Gets the {@link Session} by the {@link Session#getId()} or null if no

View File

@@ -386,13 +386,14 @@ public class RedisOperationsSessionRepository implements
this.redisFlushMode = redisFlushMode;
}
public void save(RedisSession session) {
public RedisSession save(RedisSession session) {
session.saveDelta();
if (session.isNew()) {
String sessionCreatedKey = getSessionCreatedChannel(session.getId());
this.sessionRedisOperations.convertAndSend(sessionCreatedKey, session.delta);
session.setNew(false);
}
return session;
}
@Scheduled(cron = "${spring.session.cleanup.cron.expression:0 * * * * *}")

View File

@@ -202,12 +202,13 @@ public class HazelcastSessionRepository implements
return result;
}
public void save(HazelcastSession session) {
public HazelcastSession save(HazelcastSession session) {
if (session.isChanged()) {
this.sessions.put(session.getId(), session.getDelegate(),
session.getMaxInactiveInterval().getSeconds(), TimeUnit.SECONDS);
session.markUnchanged();
}
return session;
}
public HazelcastSession getSession(String id) {

View File

@@ -371,7 +371,7 @@ public class JdbcOperationsSessionRepository implements
return session;
}
public void save(final JdbcSession session) {
public JdbcSession save(final JdbcSession session) {
if (session.isNew()) {
this.transactionOperations.execute(new TransactionCallbackWithoutResult() {
@@ -458,6 +458,7 @@ public class JdbcOperationsSessionRepository implements
});
}
session.clearChangeFlags();
return session;
}
public JdbcSession getSession(final String id) {