@Test public void enableSessionValidation() throws InterruptedException { Assert.assertTrue(executorServiceSessionValidationScheduler.isEnabled()); executorServiceSessionValidationScheduler.disableSessionValidation(); Thread.sleep(2000L); Assert.assertFalse(executorServiceSessionValidationScheduler.isEnabled()); executorServiceSessionValidationScheduler.enableSessionValidation(); Thread.sleep(2000L); Assert.assertTrue(executorServiceSessionValidationScheduler.isEnabled()); }
public void enableSessionValidation() { if (this.sessionValidationInterval > 0l) { this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { private final AtomicInteger count = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(threadNamePrefix + count.getAndIncrement()); return thread; } }); this.service.scheduleAtFixedRate(this, sessionValidationInterval, sessionValidationInterval, TimeUnit.MILLISECONDS); } this.enabled = true; }
ExecutorServiceSessionValidationScheduler implements SessionValidationScheduler, Runnable { public void enableSessionValidation() { if (this.sessionValidationInterval > 0l) { this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { private final AtomicInteger count = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(threadNamePrefix + count.getAndIncrement()); return thread; } }); this.service.scheduleAtFixedRate(this, sessionValidationInterval, sessionValidationInterval, TimeUnit.MILLISECONDS); } this.enabled = true; } }
ExecutorServiceSessionValidationScheduler implements SessionValidationScheduler, Runnable { public void enableSessionValidation() { if (this.sessionValidationInterval > 0l) { this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { private final AtomicInteger count = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(threadNamePrefix + count.getAndIncrement()); return thread; } }); this.service.scheduleAtFixedRate(this, sessionValidationInterval, sessionValidationInterval, TimeUnit.MILLISECONDS); } this.enabled = true; } ExecutorServiceSessionValidationScheduler();  ExecutorServiceSessionValidationScheduler(ValidatingSessionManager sessionManager); }
ExecutorServiceSessionValidationScheduler implements SessionValidationScheduler, Runnable { public void enableSessionValidation() { if (this.sessionValidationInterval > 0l) { this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { private final AtomicInteger count = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(threadNamePrefix + count.getAndIncrement()); return thread; } }); this.service.scheduleAtFixedRate(this, sessionValidationInterval, sessionValidationInterval, TimeUnit.MILLISECONDS); } this.enabled = true; } ExecutorServiceSessionValidationScheduler();  ExecutorServiceSessionValidationScheduler(ValidatingSessionManager sessionManager); ValidatingSessionManager getSessionManager(); void setSessionManager(ValidatingSessionManager sessionManager); long getSessionValidationInterval(); void setSessionValidationInterval(long sessionValidationInterval); boolean isEnabled(); void setThreadNamePrefix(String threadNamePrefix); String getThreadNamePrefix(); void enableSessionValidation(); void run(); void disableSessionValidation(); }
ExecutorServiceSessionValidationScheduler implements SessionValidationScheduler, Runnable { public void enableSessionValidation() { if (this.sessionValidationInterval > 0l) { this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { private final AtomicInteger count = new AtomicInteger(1); public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(threadNamePrefix + count.getAndIncrement()); return thread; } }); this.service.scheduleAtFixedRate(this, sessionValidationInterval, sessionValidationInterval, TimeUnit.MILLISECONDS); } this.enabled = true; } ExecutorServiceSessionValidationScheduler();  ExecutorServiceSessionValidationScheduler(ValidatingSessionManager sessionManager); ValidatingSessionManager getSessionManager(); void setSessionManager(ValidatingSessionManager sessionManager); long getSessionValidationInterval(); void setSessionValidationInterval(long sessionValidationInterval); boolean isEnabled(); void setThreadNamePrefix(String threadNamePrefix); String getThreadNamePrefix(); void enableSessionValidation(); void run(); void disableSessionValidation();  }