|
|
|
@ -48,10 +48,15 @@ public class RedissonSession extends StandardSession {
|
|
|
|
|
private static final String MAX_INACTIVE_INTERVAL_ATTR = "session:maxInactiveInterval";
|
|
|
|
|
private static final String LAST_ACCESSED_TIME_ATTR = "session:lastAccessedTime";
|
|
|
|
|
private static final String CREATION_TIME_ATTR = "session:creationTime";
|
|
|
|
|
private static final String IS_EXPIRATION_LOCKED = "session:isExpirationLocked";
|
|
|
|
|
|
|
|
|
|
public static final Set<String> ATTRS = new HashSet<String>(Arrays.asList(IS_NEW_ATTR, IS_VALID_ATTR,
|
|
|
|
|
THIS_ACCESSED_TIME_ATTR, MAX_INACTIVE_INTERVAL_ATTR, LAST_ACCESSED_TIME_ATTR, CREATION_TIME_ATTR));
|
|
|
|
|
public static final Set<String> ATTRS = new HashSet<String>(Arrays.asList(
|
|
|
|
|
IS_NEW_ATTR, IS_VALID_ATTR,
|
|
|
|
|
THIS_ACCESSED_TIME_ATTR, MAX_INACTIVE_INTERVAL_ATTR,
|
|
|
|
|
LAST_ACCESSED_TIME_ATTR, CREATION_TIME_ATTR, IS_EXPIRATION_LOCKED
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
private boolean isExpirationLocked;
|
|
|
|
|
private boolean loaded;
|
|
|
|
|
private final RedissonSessionManager redissonManager;
|
|
|
|
|
private final Map<String, Object> attrs;
|
|
|
|
@ -147,6 +152,7 @@ public class RedissonSession extends StandardSession {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (broadcastSessionEvents) {
|
|
|
|
|
map.fastPut(IS_EXPIRATION_LOCKED, true);
|
|
|
|
|
map.expire(60, TimeUnit.SECONDS);
|
|
|
|
|
} else {
|
|
|
|
|
map.delete();
|
|
|
|
@ -190,6 +196,9 @@ public class RedissonSession extends StandardSession {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void expireSession() {
|
|
|
|
|
if (isExpirationLocked) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (maxInactiveInterval >= 0) {
|
|
|
|
|
map.expire(maxInactiveInterval + 60, TimeUnit.SECONDS);
|
|
|
|
|
}
|
|
|
|
@ -307,7 +316,10 @@ public class RedissonSession extends StandardSession {
|
|
|
|
|
newMap.put(MAX_INACTIVE_INTERVAL_ATTR, maxInactiveInterval);
|
|
|
|
|
newMap.put(IS_VALID_ATTR, isValid);
|
|
|
|
|
newMap.put(IS_NEW_ATTR, isNew);
|
|
|
|
|
|
|
|
|
|
if (broadcastSessionEvents) {
|
|
|
|
|
newMap.put(IS_EXPIRATION_LOCKED, isExpirationLocked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (attrs != null) {
|
|
|
|
|
for (Entry<String, Object> entry : attrs.entrySet()) {
|
|
|
|
|
newMap.put(entry.getKey(), entry.getValue());
|
|
|
|
@ -356,6 +368,10 @@ public class RedissonSession extends StandardSession {
|
|
|
|
|
if (isNew != null) {
|
|
|
|
|
this.isNew = isNew;
|
|
|
|
|
}
|
|
|
|
|
Boolean isExpirationLocked = (Boolean) attrs.remove(IS_EXPIRATION_LOCKED);
|
|
|
|
|
if (isExpirationLocked != null) {
|
|
|
|
|
this.isExpirationLocked = isExpirationLocked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Entry<String, Object> entry : attrs.entrySet()) {
|
|
|
|
|
super.setAttribute(entry.getKey(), entry.getValue(), false);
|
|
|
|
|