Repository: shiro Updated Branches: refs/heads/1.2.x 7e4c1f014 -> 2eaf2e5e0
SHIRO-443: Added DCL around creation of session validation scheduler. To make sure it is created only once, and to not end up with multiple daemon threads lurking around in case of heavy load on startup for session creation. closes #4 Project: http://git-wip-us.apache.org/repos/asf/shiro/repo Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/2eaf2e5e Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/2eaf2e5e Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/2eaf2e5e Branch: refs/heads/1.2.x Commit: 2eaf2e5e03bf02153b3c2eb47a54d013d380c323 Parents: 7e4c1f0 Author: Tamas Cservenak <[email protected]> Authored: Thu May 23 10:47:46 2013 +0200 Committer: bdemers <[email protected]> Committed: Fri Mar 25 12:23:38 2016 -0400 ---------------------------------------------------------------------- .../session/mgt/AbstractValidatingSessionManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/shiro/blob/2eaf2e5e/core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java b/core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java index 8432318..4743dba 100644 --- a/core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java +++ b/core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java @@ -220,17 +220,17 @@ public abstract class AbstractValidatingSessionManager extends AbstractNativeSes return scheduler; } - protected void enableSessionValidation() { + protected synchronized void enableSessionValidation() { SessionValidationScheduler scheduler = getSessionValidationScheduler(); if (scheduler == null) { scheduler = createSessionValidationScheduler(); setSessionValidationScheduler(scheduler); + if (log.isInfoEnabled()) { + log.info("Enabling session validation scheduler..."); + } + scheduler.enableSessionValidation(); + afterSessionValidationEnabled(); } - if (log.isInfoEnabled()) { - log.info("Enabling session validation scheduler..."); - } - scheduler.enableSessionValidation(); - afterSessionValidationEnabled(); } protected void afterSessionValidationEnabled() {
