Consistent Lock field declaration (instead of ReentrantLock field type)
(cherry picked from commit b4153618a4)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -27,6 +27,7 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import org.springframework.context.ResourceLoaderAware;
|
import org.springframework.context.ResourceLoaderAware;
|
||||||
@@ -400,7 +401,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the PropertiesHolder for the given bundle filename.
|
* Refresh the PropertiesHolder for the given bundle filename.
|
||||||
* The holder can be {@code null} if not cached before, or a timed-out cache entry
|
* <p>The holder can be {@code null} if not cached before, or a timed-out cache entry
|
||||||
* (potentially getting re-validated against the current last-modified timestamp).
|
* (potentially getting re-validated against the current last-modified timestamp).
|
||||||
* @param filename the bundle filename (basename + Locale)
|
* @param filename the bundle filename (basename + Locale)
|
||||||
* @param propHolder the current PropertiesHolder for the bundle
|
* @param propHolder the current PropertiesHolder for the bundle
|
||||||
@@ -561,7 +562,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
|||||||
|
|
||||||
private volatile long refreshTimestamp = -2;
|
private volatile long refreshTimestamp = -2;
|
||||||
|
|
||||||
private final ReentrantLock refreshLock = new ReentrantLock();
|
private final Lock refreshLock = new ReentrantLock();
|
||||||
|
|
||||||
/** Cache to hold already generated MessageFormats per message code. */
|
/** Cache to hold already generated MessageFormats per message code. */
|
||||||
private final ConcurrentMap<String, Map<Locale, MessageFormat>> cachedMessageFormats =
|
private final ConcurrentMap<String, Map<Locale, MessageFormat>> cachedMessageFormats =
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,6 +26,7 @@ import java.util.Iterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@@ -315,12 +316,10 @@ public class InMemoryWebSessionStore implements WebSessionStore {
|
|||||||
/** Max time between expiration checks. */
|
/** Max time between expiration checks. */
|
||||||
private static final int CHECK_PERIOD = 60 * 1000;
|
private static final int CHECK_PERIOD = 60 * 1000;
|
||||||
|
|
||||||
|
private final Lock lock = new ReentrantLock();
|
||||||
private final ReentrantLock lock = new ReentrantLock();
|
|
||||||
|
|
||||||
private Instant checkTime = clock.instant().plus(CHECK_PERIOD, ChronoUnit.MILLIS);
|
private Instant checkTime = clock.instant().plus(CHECK_PERIOD, ChronoUnit.MILLIS);
|
||||||
|
|
||||||
|
|
||||||
public void checkIfNecessary(Instant now) {
|
public void checkIfNecessary(Instant now) {
|
||||||
if (this.checkTime.isBefore(now)) {
|
if (this.checkTime.isBefore(now)) {
|
||||||
removeExpiredSessions(now);
|
removeExpiredSessions(now);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,6 +25,7 @@ import java.util.Set;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@@ -98,7 +99,7 @@ public class SubProtocolWebSocketHandler
|
|||||||
|
|
||||||
private volatile long lastSessionCheckTime = System.currentTimeMillis();
|
private volatile long lastSessionCheckTime = System.currentTimeMillis();
|
||||||
|
|
||||||
private final ReentrantLock sessionCheckLock = new ReentrantLock();
|
private final Lock sessionCheckLock = new ReentrantLock();
|
||||||
|
|
||||||
private final DefaultStats stats = new DefaultStats();
|
private final DefaultStats stats = new DefaultStats();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user