Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SHIRO-398] - Renamed the variable interval to sessionValidationInterval #245

Merged
merged 1 commit into from
Jul 26, 2020
Merged
Show file tree
Hide file tree
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 @@ -213,7 +213,7 @@ protected SessionValidationScheduler createSessionValidationScheduler() {
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() + "].");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* 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
*/
Expand All @@ -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-";

Expand All @@ -64,12 +64,12 @@ public void setSessionManager(ValidatingSessionManager sessionManager) {
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() {
Expand All @@ -91,7 +91,7 @@ public String getThreadNamePrefix() {
//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);

Expand All @@ -102,7 +102,8 @@ public Thread newThread(Runnable r) {
return thread;
}
});
this.service.scheduleAtFixedRate(this, interval, interval, TimeUnit.MILLISECONDS);
this.service.scheduleAtFixedRate(this, sessionValidationInterval,
sessionValidationInterval, TimeUnit.MILLISECONDS);
}
this.enabled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void setUp() {
executorServiceSessionValidationScheduler = new ExecutorServiceSessionValidationScheduler();
executorServiceSessionValidationScheduler.setSessionManager(defaultSessionManager);
executorServiceSessionValidationScheduler.setThreadNamePrefix("test-");
executorServiceSessionValidationScheduler.setInterval(1000L);
executorServiceSessionValidationScheduler.setSessionValidationInterval(1000L);
executorServiceSessionValidationScheduler.enableSessionValidation();
}

Expand Down Expand Up @@ -81,7 +81,7 @@ public void threadException() throws InterruptedException {
executorServiceSessionValidationScheduler = new ExecutorServiceSessionValidationScheduler();
executorServiceSessionValidationScheduler.setSessionManager(defaultSessionManager);
executorServiceSessionValidationScheduler.setThreadNamePrefix("test-");
executorServiceSessionValidationScheduler.setInterval(1000L);
executorServiceSessionValidationScheduler.setSessionValidationInterval(1000L);
executorServiceSessionValidationScheduler.enableSessionValidation();
defaultSessionManager.create(session);
Thread.sleep(2000L);
Expand All @@ -101,4 +101,4 @@ public void validateSessions() throws RuntimeException {
throw new RuntimeException("Session test exception");
}
}
}
}