Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.shiro.session.mgt;

import lombok.NonNull;
import org.apache.shiro.session.ExpiredSessionException;
import org.apache.shiro.session.InvalidSessionException;
import org.apache.shiro.session.StoppedSessionException;
Expand Down Expand Up @@ -102,9 +103,13 @@ public class SimpleSession implements ValidatingSession, Serializable {
private transient volatile Map<Object, Object> attributes;

public SimpleSession() {
this(new Date());
}

public SimpleSession(Date startTimestamp) {
//TODO - remove concrete reference to DefaultSessionManager
this.timeout = new AtomicLong(DefaultSessionManager.DEFAULT_GLOBAL_SESSION_TIMEOUT);
this.startTimestamp = new Date();
this.startTimestamp = startTimestamp;
this.stopTimestamp = new AtomicReference<>();
this.lastAccessTime = new AtomicReference<>(this.startTimestamp);
}
Expand All @@ -114,6 +119,15 @@ public SimpleSession(String host) {
this.host = host;
}

/**
* @param host null allowed
* @param startTimestamp null not allowed
*/
public SimpleSession(String host, @NonNull Date startTimestamp) {
this(startTimestamp);
this.host = host;
}

@Override
public Serializable getId() {
return this.id;
Expand Down
Loading