public class StandardSessionManager extends Object implements WxSessionManager, InternalSessionManager
限定符和类型 | 字段和说明 |
---|---|
protected int |
backgroundProcessorDelay
background processor delay in seconds
|
protected org.slf4j.Logger |
log |
protected int |
maxActive |
protected int |
maxActiveSessions
The maximum number of active Sessions allowed, or -1 for no limit.
|
protected int |
maxInactiveInterval
The default maximum inactive interval for Sessions created by
this Manager.
|
protected int |
processExpiresFrequency
Frequency of the session expiration, and related manager operations.
|
protected long |
processingTime
Processing time during session expiration.
|
protected int |
rejectedSessions
Number of session creations that failed due to maxActiveSessions.
|
protected long |
sessionCounter
Number of sessions created by this manager
|
protected Map<String,InternalSession> |
sessions
The set of currently active Sessions for this Manager, keyed by
session identifier.
|
protected static StringManager |
SM |
构造器和说明 |
---|
StandardSessionManager() |
限定符和类型 | 方法和说明 |
---|---|
void |
add(InternalSession session)
Add this Session to the set of active Sessions for this Manager.
|
void |
backgroundProcess()
Implements the Manager interface, direct call to processExpires
|
InternalSession |
createEmptySession()
Get a session from the recycled ones or create a new empty one.
|
InternalSession |
createSession(String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
InternalSession |
findSession(String id)
Return the active Session, associated with this Manager, with the
specified session id (if any); otherwise return
null . |
InternalSession[] |
findSessions()
Return the set of active Sessions associated with this Manager.
|
int |
getActiveSessions()
Returns the number of active sessions
|
String |
getName()
Return the descriptive short name of this Manager implementation.
|
protected InternalSession |
getNewSession()
Get new session class to be used in the doLoad() method.
|
WxSession |
getSession(String sessionId)
获取某个sessionId对应的session,如果sessionId没有对应的session,则新建一个并返回。
|
WxSession |
getSession(String sessionId,
boolean create)
获取某个sessionId对应的session,如果sessionId没有对应的session,若create为true则新建一个,否则返回null。
|
void |
processExpires()
Invalidate all sessions that have expired.
|
void |
remove(InternalSession session)
Remove this Session from the active Sessions for this Manager.
|
void |
remove(InternalSession session,
boolean update)
Remove this Session from the active Sessions for this Manager.
|
void |
setBackgroundProcessorDelay(int backgroundProcessorDelay)
Set the manager background processor delay
设置manager sleep几秒,尝试执行一次background操作(清理过期session)
|
void |
setMaxActiveSessions(int max)
Set the maximum number of active Sessions allowed, or -1 for
no limit.
|
void |
setMaxInactiveInterval(int interval)
Set the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
void |
setProcessExpiresFrequency(int processExpiresFrequency)
Set the manager checks frequency.
|
protected static final StringManager SM
protected final org.slf4j.Logger log
protected Map<String,InternalSession> sessions
protected int maxActiveSessions
protected int rejectedSessions
protected int maxInactiveInterval
protected long sessionCounter
protected volatile int maxActive
protected long processingTime
protected int processExpiresFrequency
protected int backgroundProcessorDelay
public WxSession getSession(String sessionId)
WxSessionManager
getSession
在接口中 WxSessionManager
public WxSession getSession(String sessionId, boolean create)
WxSessionManager
getSession
在接口中 WxSessionManager
public void remove(InternalSession session)
InternalSessionManager
remove
在接口中 InternalSessionManager
session
- Session to be removedpublic void remove(InternalSession session, boolean update)
InternalSessionManager
remove
在接口中 InternalSessionManager
session
- Session to be removedupdate
- Should the expiration statistics be updatedpublic InternalSession findSession(String id)
InternalSessionManager
null
.findSession
在接口中 InternalSessionManager
id
- The session id for the session to be returnedpublic InternalSession createSession(String sessionId)
InternalSessionManager
null
.createSession
在接口中 InternalSessionManager
sessionId
- The session id which should be used to create the
new session; if null
, a new session id will be
generatedpublic int getActiveSessions()
InternalSessionManager
getActiveSessions
在接口中 InternalSessionManager
public InternalSession createEmptySession()
InternalSessionManager
createEmptySession
在接口中 InternalSessionManager
protected InternalSession getNewSession()
public void add(InternalSession session)
InternalSessionManager
add
在接口中 InternalSessionManager
session
- Session to be addedpublic InternalSession[] findSessions()
findSessions
在接口中 InternalSessionManager
public void backgroundProcess()
InternalSessionManager
backgroundProcess
在接口中 InternalSessionManager
public void processExpires()
public void setMaxInactiveInterval(int interval)
InternalSessionManager
setMaxInactiveInterval
在接口中 InternalSessionManager
interval
- The new default valuepublic void setProcessExpiresFrequency(int processExpiresFrequency)
setProcessExpiresFrequency
在接口中 InternalSessionManager
processExpiresFrequency
- the new manager checks frequencypublic void setBackgroundProcessorDelay(int backgroundProcessorDelay)
InternalSessionManager
Set the manager background processor delay 设置manager sleep几秒,尝试执行一次background操作(清理过期session)
public String getName()
public void setMaxActiveSessions(int max)
setMaxActiveSessions
在接口中 InternalSessionManager
max
- The new maximum number of sessionsCopyright © 2024. All rights reserved.