diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCleanupPoller.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCleanupPoller.java index bc138e9daa..63a489449b 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCleanupPoller.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCleanupPoller.java @@ -5,7 +5,6 @@ import javax.inject.Singleton; -import com.google.common.base.Optional; import com.google.inject.Inject; import com.google.inject.name.Named; import com.hubspot.singularity.config.SingularityConfiguration; @@ -18,7 +17,7 @@ public class SingularityCleanupPoller extends SingularityLeaderOnlyPoller { @Inject SingularityCleanupPoller(SingularityConfiguration configuration, SingularityCleaner cleaner, @Named(SingularityMesosModule.SCHEDULER_LOCK_NAME) final Lock lock) { - super(configuration.getCleanupEverySeconds(), TimeUnit.SECONDS, Optional.of(lock)); + super(configuration.getCleanupEverySeconds(), TimeUnit.SECONDS, lock); this.cleaner = cleaner; } diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCooldownPoller.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCooldownPoller.java index e069d13202..a463e41710 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCooldownPoller.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityCooldownPoller.java @@ -5,7 +5,6 @@ import javax.inject.Singleton; -import com.google.common.base.Optional; import com.google.inject.Inject; import com.google.inject.name.Named; import com.hubspot.singularity.config.SingularityConfiguration; @@ -18,7 +17,7 @@ public class SingularityCooldownPoller extends SingularityLeaderOnlyPoller { @Inject SingularityCooldownPoller(SingularityConfiguration configuration, SingularityCooldownChecker checker, @Named(SingularityMesosModule.SCHEDULER_LOCK_NAME) final Lock lock) { - super(TimeUnit.MINUTES.toMillis(configuration.getCooldownExpiresAfterMinutes()) / 2, TimeUnit.MILLISECONDS, Optional.of(lock)); + super(TimeUnit.MINUTES.toMillis(configuration.getCooldownExpiresAfterMinutes()) / 2, TimeUnit.MILLISECONDS, lock); this.checker = checker; } diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityDeployPoller.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityDeployPoller.java index addd7e0afe..65bbebcec4 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityDeployPoller.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityDeployPoller.java @@ -8,7 +8,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; import com.google.inject.Inject; import com.google.inject.name.Named; import com.hubspot.mesos.JavaUtils; @@ -24,7 +23,7 @@ public class SingularityDeployPoller extends SingularityLeaderOnlyPoller { @Inject SingularityDeployPoller(SingularityDeployChecker deployChecker, SingularityConfiguration configuration, @Named(SingularityMesosModule.SCHEDULER_LOCK_NAME) final Lock lock) { - super(configuration.getCheckDeploysEverySeconds(), TimeUnit.SECONDS, Optional.of(lock)); + super(configuration.getCheckDeploysEverySeconds(), TimeUnit.SECONDS, lock); this.deployChecker = deployChecker; } diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityLeaderOnlyPoller.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityLeaderOnlyPoller.java index f05ec2303d..ea28fdded3 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityLeaderOnlyPoller.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularityLeaderOnlyPoller.java @@ -40,7 +40,11 @@ protected SingularityLeaderOnlyPoller(long pollDelay, TimeUnit pollTimeUnit) { this(pollDelay, pollTimeUnit, Optional. absent()); } - protected SingularityLeaderOnlyPoller(long pollDelay, TimeUnit pollTimeUnit, Optional lockHolder) { + protected SingularityLeaderOnlyPoller(long pollDelay, TimeUnit pollTimeUnit, Lock lock) { + this(pollDelay, pollTimeUnit, Optional.of(lock)); + } + + private SingularityLeaderOnlyPoller(long pollDelay, TimeUnit pollTimeUnit, Optional lockHolder) { this.pollDelay = pollDelay; this.pollTimeUnit = pollTimeUnit; this.lockHolder = lockHolder; diff --git a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularitySchedulerPoller.java b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularitySchedulerPoller.java index 62aaf399ee..7352b6154f 100644 --- a/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularitySchedulerPoller.java +++ b/SingularityService/src/main/java/com/hubspot/singularity/scheduler/SingularitySchedulerPoller.java @@ -8,7 +8,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.name.Named; @@ -27,7 +26,7 @@ public class SingularitySchedulerPoller extends SingularityLeaderOnlyPoller { @Inject SingularitySchedulerPoller(Provider stateCacheProvider, SingularityScheduler scheduler, SingularityConfiguration configuration, @Named(SingularityMesosModule.SCHEDULER_LOCK_NAME) final Lock lock) { - super(configuration.getCheckSchedulerEverySeconds(), TimeUnit.SECONDS, Optional.of(lock)); + super(configuration.getCheckSchedulerEverySeconds(), TimeUnit.SECONDS, lock); this.stateCacheProvider = stateCacheProvider; this.scheduler = scheduler;