You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2020/07/26 12:46:31 UTC

[shiro] branch master updated: Renamed the variable interval to sessionValidationInterval to make it consistent across implemetations.

This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/master by this push:
     new 270b940  Renamed the variable interval to sessionValidationInterval to make it consistent across implemetations.
     new b294b30  Merge pull request #245 from vgaur/SHIRO-398
270b940 is described below

commit 270b9403b5ad2ea82c9c6a3cbe108d631be5efe3
Author: Vishal Gaurav <vi...@ezops.com>
AuthorDate: Sat Jul 25 12:52:30 2020 +0530

    Renamed the variable interval to sessionValidationInterval to make it consistent across implemetations.
---
 .../session/mgt/AbstractValidatingSessionManager.java   |  2 +-
 .../mgt/ExecutorServiceSessionValidationScheduler.java  | 17 +++++++++--------
 .../ExecutorServiceSessionValidationSchedulerTest.java  |  6 +++---
 3 files changed, 13 insertions(+), 12 deletions(-)

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 e6a1bb3..8991bba 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
@@ -213,7 +213,7 @@ public abstract class AbstractValidatingSessionManager extends AbstractNativeSes
             log.debug("No sessionValidationScheduler set.  Attempting to create default instance.");
         }
         scheduler = new ExecutorServiceSessionValidationScheduler(this);
-        scheduler.setInterval(getSessionValidationInterval());
+        scheduler.setSessionValidationInterval(getSessionValidationInterval());
         if (log.isTraceEnabled()) {
             log.trace("Created default SessionValidationScheduler instance of type [" + scheduler.getClass().getName() + "].");
         }
diff --git a/core/src/main/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationScheduler.java b/core/src/main/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationScheduler.java
index 657a377..fc10de7 100644
--- a/core/src/main/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationScheduler.java
+++ b/core/src/main/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationScheduler.java
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
 /**
  * SessionValidationScheduler implementation that uses a
  * {@link ScheduledExecutorService} to call {@link ValidatingSessionManager#validateSessions()} every
- * <em>{@link #getInterval interval}</em> milliseconds.
+ * <em>{@link #getSessionValidationInterval sessionValidationInterval}</em> milliseconds.
  *
  * @since 0.9
  */
@@ -44,7 +44,7 @@ public class ExecutorServiceSessionValidationScheduler implements SessionValidat
 
     ValidatingSessionManager sessionManager;
     private ScheduledExecutorService service;
-    private long interval = DefaultSessionManager.DEFAULT_SESSION_VALIDATION_INTERVAL;
+    private long sessionValidationInterval = DefaultSessionManager.DEFAULT_SESSION_VALIDATION_INTERVAL;
     private boolean enabled = false;
     private String threadNamePrefix = "SessionValidationThread-";
 
@@ -64,12 +64,12 @@ public class ExecutorServiceSessionValidationScheduler implements SessionValidat
         this.sessionManager = sessionManager;
     }
 
-    public long getInterval() {
-        return interval;
+    public long getSessionValidationInterval() {
+        return sessionValidationInterval;
     }
 
-    public void setInterval(long interval) {
-        this.interval = interval;
+    public void setSessionValidationInterval(long sessionValidationInterval) {
+        this.sessionValidationInterval = sessionValidationInterval;
     }
 
     public boolean isEnabled() {
@@ -91,7 +91,7 @@ public class ExecutorServiceSessionValidationScheduler implements SessionValidat
     //TODO Implement an integration test to test for jvm exit as part of the standalone example
     // (so we don't have to change the unit test execution model for the core module)
     public void enableSessionValidation() {
-        if (this.interval > 0l) {
+        if (this.sessionValidationInterval > 0l) {
             this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {  
 	            private final AtomicInteger count = new AtomicInteger(1);
 
@@ -102,7 +102,8 @@ public class ExecutorServiceSessionValidationScheduler implements SessionValidat
 	                return thread;  
 	            }  
             });                  
-            this.service.scheduleAtFixedRate(this, interval, interval, TimeUnit.MILLISECONDS);
+            this.service.scheduleAtFixedRate(this, sessionValidationInterval,
+                sessionValidationInterval, TimeUnit.MILLISECONDS);
         }
         this.enabled = true;
     }
diff --git a/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java b/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java
index bb5ba64..8ae53a6 100644
--- a/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java
+++ b/core/src/test/java/org/apache/shiro/session/mgt/ExecutorServiceSessionValidationSchedulerTest.java
@@ -36,7 +36,7 @@ public class ExecutorServiceSessionValidationSchedulerTest {
         executorServiceSessionValidationScheduler = new ExecutorServiceSessionValidationScheduler();
         executorServiceSessionValidationScheduler.setSessionManager(defaultSessionManager);
         executorServiceSessionValidationScheduler.setThreadNamePrefix("test-");
-        executorServiceSessionValidationScheduler.setInterval(1000L);
+        executorServiceSessionValidationScheduler.setSessionValidationInterval(1000L);
         executorServiceSessionValidationScheduler.enableSessionValidation();
     }
 
@@ -81,7 +81,7 @@ public class ExecutorServiceSessionValidationSchedulerTest {
         executorServiceSessionValidationScheduler = new ExecutorServiceSessionValidationScheduler();
         executorServiceSessionValidationScheduler.setSessionManager(defaultSessionManager);
         executorServiceSessionValidationScheduler.setThreadNamePrefix("test-");
-        executorServiceSessionValidationScheduler.setInterval(1000L);
+        executorServiceSessionValidationScheduler.setSessionValidationInterval(1000L);
         executorServiceSessionValidationScheduler.enableSessionValidation();
         defaultSessionManager.create(session);
         Thread.sleep(2000L);
@@ -101,4 +101,4 @@ public class ExecutorServiceSessionValidationSchedulerTest {
             throw new RuntimeException("Session test exception");
         }
     }
-}
\ No newline at end of file
+}