Skip to content

Commit b415361

Browse files
committed
Consistent Lock field declaration (instead of ReentrantLock field type)
1 parent 0b09f1e commit b415361

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Properties;
2929
import java.util.concurrent.ConcurrentHashMap;
3030
import java.util.concurrent.ConcurrentMap;
31+
import java.util.concurrent.locks.Lock;
3132
import java.util.concurrent.locks.ReentrantLock;
3233

3334
import org.springframework.context.ResourceLoaderAware;
@@ -650,7 +651,7 @@ protected class PropertiesHolder {
650651

651652
private volatile long refreshTimestamp = -2;
652653

653-
private final ReentrantLock refreshLock = new ReentrantLock();
654+
private final Lock refreshLock = new ReentrantLock();
654655

655656
/** Cache to hold already generated MessageFormats per message code. */
656657
private final ConcurrentMap<String, Map<Locale, MessageFormat>> cachedMessageFormats =

spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorLifecycleDelegate.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.concurrent.ExecutorService;
2020
import java.util.concurrent.locks.Condition;
21+
import java.util.concurrent.locks.Lock;
2122
import java.util.concurrent.locks.ReentrantLock;
2223

2324
import org.springframework.context.SmartLifecycle;
@@ -36,7 +37,7 @@ final class ExecutorLifecycleDelegate implements SmartLifecycle {
3637

3738
private final ExecutorService executor;
3839

39-
private final ReentrantLock pauseLock = new ReentrantLock();
40+
private final Lock pauseLock = new ReentrantLock();
4041

4142
private final Condition unpaused = this.pauseLock.newCondition();
4243

spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
2626
import java.util.Map;
2727
import java.util.concurrent.ConcurrentHashMap;
2828
import java.util.concurrent.atomic.AtomicReference;
29+
import java.util.concurrent.locks.Lock;
2930
import java.util.concurrent.locks.ReentrantLock;
3031

3132
import reactor.core.publisher.Mono;
@@ -315,12 +316,10 @@ private class ExpiredSessionChecker {
315316
/** Max time between expiration checks. */
316317
private static final int CHECK_PERIOD = 60 * 1000;
317318

318-
319-
private final ReentrantLock lock = new ReentrantLock();
319+
private final Lock lock = new ReentrantLock();
320320

321321
private Instant checkTime = clock.instant().plus(CHECK_PERIOD, ChronoUnit.MILLIS);
322322

323-
324323
public void checkIfNecessary(Instant now) {
325324
if (this.checkTime.isBefore(now)) {
326325
removeExpiredSessions(now);

spring-websocket/src/main/java/org/springframework/web/socket/messaging/SubProtocolWebSocketHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.TreeMap;
2626
import java.util.concurrent.ConcurrentHashMap;
2727
import java.util.concurrent.atomic.AtomicInteger;
28+
import java.util.concurrent.locks.Lock;
2829
import java.util.concurrent.locks.ReentrantLock;
2930

3031
import org.apache.commons.logging.Log;
@@ -98,7 +99,7 @@ public class SubProtocolWebSocketHandler
9899

99100
private volatile long lastSessionCheckTime = System.currentTimeMillis();
100101

101-
private final ReentrantLock sessionCheckLock = new ReentrantLock();
102+
private final Lock sessionCheckLock = new ReentrantLock();
102103

103104
private final DefaultStats stats = new DefaultStats();
104105

0 commit comments

Comments
 (0)