Skip to content

Commit 23354b0

Browse files
committed
Fix doTask method visibility (referring to private Task type)
See gh-35794
1 parent 5c5367a commit 23354b0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ public Reference<K, V> getReference(@Nullable Object key, int hash, Restructure
628628
* @return the result of the operation
629629
*/
630630
@Nullable
631-
public <T> T doTask(final int hash, @Nullable final Object key, final Task<T> task) {
631+
private <T> T doTask(final int hash, @Nullable final Object key, final Task<T> task) {
632632
boolean resize = task.hasOption(TaskOption.RESIZE);
633633
if (task.hasOption(TaskOption.RESTRUCTURE_BEFORE)) {
634634
restructureIfNecessary(resize);
@@ -693,7 +693,6 @@ void restructureIfNecessary(boolean allowResize) {
693693
}
694694

695695
private void restructure(boolean allowResize, @Nullable Reference<K, V> ref) {
696-
boolean needsResize;
697696
lock();
698697
try {
699698
int expectedCount = this.count.get();
@@ -709,7 +708,7 @@ private void restructure(boolean allowResize, @Nullable Reference<K, V> ref) {
709708

710709
// Estimate new count, taking into account count inside lock and items that
711710
// will be purged.
712-
needsResize = (expectedCount > 0 && expectedCount >= this.resizeThreshold);
711+
boolean needsResize = (expectedCount > 0 && expectedCount >= this.resizeThreshold);
713712
boolean resizing = false;
714713
int restructureSize = this.references.length;
715714
if (allowResize && needsResize && restructureSize < MAXIMUM_SEGMENT_SIZE) {
@@ -750,8 +749,8 @@ private void restructure(boolean allowResize, @Nullable Reference<K, V> ref) {
750749
while (ref != null) {
751750
if (!toPurge.contains(ref)) {
752751
Entry<K, V> entry = ref.get();
753-
// Also filter out null references that are now null
754-
// they should be polled from the queue in a later restructure call.
752+
// Also filter out null references that are now null:
753+
// They should be polled from the queue in a later restructure call.
755754
if (entry != null) {
756755
purgedRef = this.referenceManager.createReference(
757756
entry, ref.getHash(), purgedRef);
@@ -763,7 +762,7 @@ private void restructure(boolean allowResize, @Nullable Reference<K, V> ref) {
763762
this.references[i] = purgedRef;
764763
}
765764
}
766-
this.count.set(Math.max(newCount, 0));
765+
this.count.set(newCount);
767766
}
768767
finally {
769768
unlock();

0 commit comments

Comments
 (0)