Skip to content

Commit b976ee3

Browse files
committed
Consistent Lock field declaration (instead of ReentrantLock field type)
(cherry picked from commit b415361)
1 parent b11ff96 commit b976ee3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 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.
@@ -27,6 +27,7 @@
2727
import java.util.Properties;
2828
import java.util.concurrent.ConcurrentHashMap;
2929
import java.util.concurrent.ConcurrentMap;
30+
import java.util.concurrent.locks.Lock;
3031
import java.util.concurrent.locks.ReentrantLock;
3132

3233
import org.springframework.context.ResourceLoaderAware;
@@ -400,7 +401,7 @@ protected PropertiesHolder getProperties(String filename) {
400401

401402
/**
402403
* Refresh the PropertiesHolder for the given bundle filename.
403-
* The holder can be {@code null} if not cached before, or a timed-out cache entry
404+
* <p>The holder can be {@code null} if not cached before, or a timed-out cache entry
404405
* (potentially getting re-validated against the current last-modified timestamp).
405406
* @param filename the bundle filename (basename + Locale)
406407
* @param propHolder the current PropertiesHolder for the bundle
@@ -561,7 +562,7 @@ protected class PropertiesHolder {
561562

562563
private volatile long refreshTimestamp = -2;
563564

564-
private final ReentrantLock refreshLock = new ReentrantLock();
565+
private final Lock refreshLock = new ReentrantLock();
565566

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

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: 3 additions & 2 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.
@@ -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)