This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 85d8656a14 Code clean-up - formatting. No functional change. 85d8656a14 is described below commit 85d8656a147848ef137c9cf3b38d16dea2baa47c Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu May 22 14:07:29 2025 +0100 Code clean-up - formatting. No functional change. --- .../util/collections/CaseInsensitiveKeyMap.java | 22 +++++++--------- .../tomcat/util/collections/ConcurrentCache.java | 2 +- .../util/collections/ConcurrentLruCache.java | 4 +-- .../collections/ManagedConcurrentWeakHashMap.java | 30 +++++++++------------- .../tomcat/util/collections/SynchronizedQueue.java | 8 +++--- .../tomcat/util/collections/SynchronizedStack.java | 8 +++--- 6 files changed, 30 insertions(+), 44 deletions(-) diff --git a/java/org/apache/tomcat/util/collections/CaseInsensitiveKeyMap.java b/java/org/apache/tomcat/util/collections/CaseInsensitiveKeyMap.java index c97a104826..cd2d12e5f3 100644 --- a/java/org/apache/tomcat/util/collections/CaseInsensitiveKeyMap.java +++ b/java/org/apache/tomcat/util/collections/CaseInsensitiveKeyMap.java @@ -27,11 +27,9 @@ import java.util.Set; import org.apache.tomcat.util.res.StringManager; /** - * A Map implementation that uses case-insensitive (using {@link - * Locale#ENGLISH}) strings as keys. + * A Map implementation that uses case-insensitive (using {@link Locale#ENGLISH}) strings as keys. * <p> - * Keys must be instances of {@link String}. Note that this means that - * <code>null</code> keys are not permitted. + * Keys must be instances of {@link String}. Note that this means that <code>null</code> keys are not permitted. * <p> * This implementation is not thread-safe. * @@ -39,8 +37,7 @@ import org.apache.tomcat.util.res.StringManager; */ public class CaseInsensitiveKeyMap<V> extends AbstractMap<String,V> { - private static final StringManager sm = - StringManager.getManager(CaseInsensitiveKeyMap.class); + private static final StringManager sm = StringManager.getManager(CaseInsensitiveKeyMap.class); private final Map<Key,V> map = new HashMap<>(); @@ -64,12 +61,11 @@ public class CaseInsensitiveKeyMap<V> extends AbstractMap<String,V> { /** * {@inheritDoc} * <p> - * <b>Use this method with caution</b>. If the input Map contains duplicate - * keys when the keys are compared in a case-insensitive manner then some - * values will be lost when inserting via this method. + * <b>Use this method with caution</b>. If the input Map contains duplicate keys when the keys are compared in a + * case-insensitive manner then some values will be lost when inserting via this method. */ @Override - public void putAll(Map<? extends String, ? extends V> m) { + public void putAll(Map<? extends String,? extends V> m) { super.putAll(m); } @@ -87,7 +83,7 @@ public class CaseInsensitiveKeyMap<V> extends AbstractMap<String,V> { @Override - public Set<Entry<String, V>> entrySet() { + public Set<Entry<String,V>> entrySet() { return new EntrySet<>(map.entrySet()); } @@ -126,8 +122,8 @@ public class CaseInsensitiveKeyMap<V> extends AbstractMap<String,V> { } @Override - public Entry<String, V> next() { - Entry<Key, V> entry = iterator.next(); + public Entry<String,V> next() { + Entry<Key,V> entry = iterator.next(); return new EntryImpl<>(entry.getKey().getKey(), entry.getValue()); } diff --git a/java/org/apache/tomcat/util/collections/ConcurrentCache.java b/java/org/apache/tomcat/util/collections/ConcurrentCache.java index 7eff23e567..6355d7d830 100644 --- a/java/org/apache/tomcat/util/collections/ConcurrentCache.java +++ b/java/org/apache/tomcat/util/collections/ConcurrentCache.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; -public final class ConcurrentCache<K,V> { +public final class ConcurrentCache<K, V> { private final int size; diff --git a/java/org/apache/tomcat/util/collections/ConcurrentLruCache.java b/java/org/apache/tomcat/util/collections/ConcurrentLruCache.java index d796d92162..99f33fe0b5 100644 --- a/java/org/apache/tomcat/util/collections/ConcurrentLruCache.java +++ b/java/org/apache/tomcat/util/collections/ConcurrentLruCache.java @@ -76,7 +76,7 @@ public class ConcurrentLruCache<T> { if (oldMap != null) { map.putAll(oldMap); } - } else { + } else { map = null; } } @@ -94,7 +94,7 @@ public class ConcurrentLruCache<T> { } - private static class LimitedLinkedHashMap<K,V> extends LinkedHashMap<K,V> { + private static class LimitedLinkedHashMap<K, V> extends LinkedHashMap<K,V> { private static final long serialVersionUID = 1L; private final int limit; diff --git a/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java b/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java index 630f989a37..b1f3c722ed 100644 --- a/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java +++ b/java/org/apache/tomcat/util/collections/ManagedConcurrentWeakHashMap.java @@ -30,23 +30,20 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** - * Concurrent hash map that holds its keys via weak references. Unlike - * <code>WeakHashMap</code> this class does not handle dead keys during common - * access operations, but expects you to call its {@link #maintain()} method + * Concurrent hash map that holds its keys via weak references. Unlike <code>WeakHashMap</code> this class does not + * handle dead keys during common access operations, but expects you to call its {@link #maintain()} method * periodically. Both keys and values are expected to be not-<code>null</code>. * * @param <K> The type of keys used with the Map instance * @param <V> The type of values used with the Map instance */ -public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implements - ConcurrentMap<K, V> { +public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K,V> implements ConcurrentMap<K,V> { - private final ConcurrentMap<Key, V> map = new ConcurrentHashMap<>(); + private final ConcurrentMap<Key,V> map = new ConcurrentHashMap<>(); private final ReferenceQueue<Object> queue = new ReferenceQueue<>(); /** - * Method, that has to be invoked periodically to clean dead keys from the - * map. + * Method, that has to be invoked periodically to clean dead keys from the map. */ public void maintain() { Key key; @@ -108,16 +105,14 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem } /** - * Creates Key instance to be used to store values in the map. It is - * registered with the ReferenceQueue. + * Creates Key instance to be used to store values in the map. It is registered with the ReferenceQueue. */ private Key createStoreKey(Object key) { return new Key(key, queue); } /** - * Creates Key instance to be used only to lookup values in the map. It is - * not registered with the ReferenceQueue. + * Creates Key instance to be used only to lookup values in the map. It is not registered with the ReferenceQueue. */ private Key createLookupKey(Object key) { return new Key(key, null); @@ -213,7 +208,7 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem } @Override - public Set<Map.Entry<K, V>> entrySet() { + public Set<Map.Entry<K,V>> entrySet() { return new AbstractSet<>() { @Override public boolean isEmpty() { @@ -226,10 +221,9 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem } @Override - public Iterator<Map.Entry<K, V>> iterator() { + public Iterator<Map.Entry<K,V>> iterator() { return new Iterator<>() { - private final Iterator<Map.Entry<Key, V>> it = map - .entrySet().iterator(); + private final Iterator<Map.Entry<Key,V>> it = map.entrySet().iterator(); @Override public boolean hasNext() { @@ -237,9 +231,9 @@ public class ManagedConcurrentWeakHashMap<K, V> extends AbstractMap<K, V> implem } @Override - public Map.Entry<K, V> next() { + public Map.Entry<K,V> next() { return new Map.Entry<>() { - private final Map.Entry<Key, V> en = it.next(); + private final Map.Entry<Key,V> en = it.next(); @SuppressWarnings("unchecked") @Override diff --git a/java/org/apache/tomcat/util/collections/SynchronizedQueue.java b/java/org/apache/tomcat/util/collections/SynchronizedQueue.java index 44c9352b86..5fd965fc4e 100644 --- a/java/org/apache/tomcat/util/collections/SynchronizedQueue.java +++ b/java/org/apache/tomcat/util/collections/SynchronizedQueue.java @@ -17,11 +17,9 @@ package org.apache.tomcat.util.collections; /** - * This is intended as a (mostly) GC-free alternative to - * {@link java.util.concurrent.ConcurrentLinkedQueue} when the requirement is to - * create an unbounded queue with no requirement to shrink the queue. The aim is - * to provide the bare minimum of required functionality as quickly as possible - * with minimum garbage. + * This is intended as a (mostly) GC-free alternative to {@link java.util.concurrent.ConcurrentLinkedQueue} when the + * requirement is to create an unbounded queue with no requirement to shrink the queue. The aim is to provide the bare + * minimum of required functionality as quickly as possible with minimum garbage. * * @param <T> The type of object managed by this queue */ diff --git a/java/org/apache/tomcat/util/collections/SynchronizedStack.java b/java/org/apache/tomcat/util/collections/SynchronizedStack.java index 992eb5890f..acd84d6290 100644 --- a/java/org/apache/tomcat/util/collections/SynchronizedStack.java +++ b/java/org/apache/tomcat/util/collections/SynchronizedStack.java @@ -17,11 +17,9 @@ package org.apache.tomcat.util.collections; /** - * This is intended as a (mostly) GC-free alternative to - * {@link java.util.Stack} when the requirement is to create a pool of re-usable - * objects with no requirement to shrink the pool. The aim is to provide the - * bare minimum of required functionality as quickly as possible with minimum - * garbage. + * This is intended as a (mostly) GC-free alternative to {@link java.util.Stack} when the requirement is to create a + * pool of re-usable objects with no requirement to shrink the pool. The aim is to provide the bare minimum of required + * functionality as quickly as possible with minimum garbage. * * @param <T> The type of object managed by this stack */ --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org