Polish Dispose default Scheduler

This commit is contained in:
Rob Winch 2019-09-30 14:42:28 -05:00
parent e0414e5cbe
commit fc8a0184b0
1 changed files with 4 additions and 9 deletions

View File

@ -56,8 +56,9 @@ public abstract class AbstractUserDetailsReactiveAuthenticationManager implement
private ReactiveUserDetailsPasswordService userDetailsPasswordService; private ReactiveUserDetailsPasswordService userDetailsPasswordService;
Scheduler scheduler = Schedulers.newParallel("password-encoder"); private final Scheduler DEFAULT_SCHEDULER = Schedulers.newParallel("password-encoder");
private boolean defaultScheduler = true;
private Scheduler scheduler = this.DEFAULT_SCHEDULER;
private UserDetailsChecker preAuthenticationChecks = user -> { private UserDetailsChecker preAuthenticationChecks = user -> {
if (!user.isAccountNonLocked()) { if (!user.isAccountNonLocked()) {
@ -140,10 +141,6 @@ public abstract class AbstractUserDetailsReactiveAuthenticationManager implement
*/ */
public void setScheduler(Scheduler scheduler) { public void setScheduler(Scheduler scheduler) {
Assert.notNull(scheduler, "scheduler cannot be null"); Assert.notNull(scheduler, "scheduler cannot be null");
if (this.defaultScheduler) {
this.defaultScheduler = false;
this.scheduler.dispose();
}
this.scheduler = scheduler; this.scheduler = scheduler;
} }
@ -179,8 +176,6 @@ public abstract class AbstractUserDetailsReactiveAuthenticationManager implement
@Override @Override
public void destroy() { public void destroy() {
if (this.defaultScheduler) { this.DEFAULT_SCHEDULER.dispose();
this.scheduler.dispose();
}
} }
} }