SessionRepository.save returns S
Issue gh-809
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 * * * * *}")
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user