Skip to content

Commit 3c45232

Browse files
committed
checkstyle
Signed-off-by: wind57 <[email protected]>
1 parent 48a6f53 commit 3c45232

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/CachedSingleThreadScheduler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,24 @@
2424
import java.util.concurrent.locks.ReentrantLock;
2525

2626
/**
27-
* This is taken from fabric8 with some minor changes
28-
* (we need it, so it could be placed in the common package)
27+
* This is taken from fabric8 with some minor changes (we need it, so it could be placed
28+
* in the common package).
29+
*
2930
* @author wind57
3031
*/
3132
public final class CachedSingleThreadScheduler {
3233

3334
private final ReentrantLock lock = new ReentrantLock();
3435

3536
private final long ttlMillis;
37+
3638
private ScheduledThreadPoolExecutor executor;
3739

3840
public CachedSingleThreadScheduler(long ttlMillis) {
3941
this.ttlMillis = ttlMillis;
4042
}
4143

42-
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay,
43-
long delay, TimeUnit unit) {
44+
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
4445
try {
4546
lock.lock();
4647
this.startExecutor();
@@ -66,7 +67,8 @@ private void startExecutor() {
6667
if (this.executor == null) {
6768
this.executor = new ScheduledThreadPoolExecutor(1, threadFactory());
6869
this.executor.setRemoveOnCancelPolicy(true);
69-
this.executor.scheduleWithFixedDelay(this::shutdownCheck, this.ttlMillis, this.ttlMillis, TimeUnit.MILLISECONDS);
70+
this.executor.scheduleWithFixedDelay(this::shutdownCheck, this.ttlMillis, this.ttlMillis,
71+
TimeUnit.MILLISECONDS);
7072
}
7173

7274
}

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/PodReady.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
package org.springframework.cloud.kubernetes.commons;
1818

19-
import org.springframework.core.log.LogAccessor;
20-
2119
import java.util.concurrent.CompletableFuture;
2220
import java.util.concurrent.TimeUnit;
2321
import java.util.function.BooleanSupplier;
2422

23+
import org.springframework.core.log.LogAccessor;
24+
2525
/**
2626
* @author wind57
2727
*/
@@ -30,8 +30,7 @@ public final class PodReady {
3030
private static final LogAccessor LOG = new LogAccessor(PodReady.class);
3131

3232
private final CachedSingleThreadScheduler podReadyScheduler = new CachedSingleThreadScheduler(
33-
TimeUnit.SECONDS.toMillis(10)
34-
);
33+
TimeUnit.SECONDS.toMillis(10));
3534

3635
public CompletableFuture<Void> podReady(BooleanSupplier isPodReady, String holderIdentity, String podNamespace) {
3736

@@ -41,14 +40,14 @@ public CompletableFuture<Void> podReady(BooleanSupplier isPodReady, String holde
4140

4241
try {
4342
LOG.info(() -> "waiting for pod : " + holderIdentity + " in namespace : " + podNamespace
44-
+ " to be ready");
43+
+ " to be ready");
4544
if (isPodReady.getAsBoolean()) {
4645
LOG.info(() -> "Pod : " + holderIdentity + " in namespace : " + podNamespace + " is ready");
4746
podReadyFuture.complete(null);
4847
}
4948
else {
50-
LOG.debug(() -> "Pod : " + holderIdentity + " in namespace : " + podNamespace
51-
+ " is not ready, " + "will retry in one second");
49+
LOG.debug(() -> "Pod : " + holderIdentity + " in namespace : " + podNamespace + " is not ready, "
50+
+ "will retry in one second");
5251
}
5352
}
5453
catch (Exception e) {

spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/election/Fabric8LeaderElectionInitiator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.fabric8.kubernetes.client.extended.leaderelection.LeaderElectionConfig;
3030
import io.fabric8.kubernetes.client.extended.leaderelection.LeaderElector;
3131
import io.fabric8.kubernetes.client.readiness.Readiness;
32-
import io.fabric8.kubernetes.client.utils.CachedSingleThreadScheduler;
3332
import jakarta.annotation.PostConstruct;
3433
import jakarta.annotation.PreDestroy;
3534

@@ -97,7 +96,8 @@ void postConstruct() {
9796
return Readiness.isPodReady(pod);
9897
}, holderIdentity, podNamespace);
9998

100-
} else {
99+
}
100+
else {
101101
podReadyFuture = new CompletableFuture<>();
102102
}
103103

0 commit comments

Comments
 (0)