Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename mergeThreadCount in ConcurrentMergeScheduler to avoid clashing with method of the same name #14171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cwperks
Copy link
Contributor

@cwperks cwperks commented Jan 25, 2025

Description

Opening up this small PR to rename mergeThreadCount (the field) to mergeThreadCounter to avoid clashing with a method in the same class also named mergeThreadCount

This variable is used to assign merge thread numbers by incrementing from 0 so I thought mergeThreadCounter may be a more appropriate name.

Resolves: #13114

Below is a snippet of the current state of the class where the field and method have the same name.

/** How many {@link MergeThread}s have kicked off (this is use to name them). */
protected int mergeThreadCount;

/**
 * Returns the number of merge threads that are alive, ignoring the calling thread if it is a
 * merge thread. Note that this number is ≤ {@link #mergeThreads} size.
 *
 * @lucene.internal
 */
public synchronized int mergeThreadCount() {
  Thread currentThread = Thread.currentThread();
  int count = 0;
  for (MergeThread mergeThread : mergeThreads) {
    if (currentThread != mergeThread
        && mergeThread.isAlive()
        && mergeThread.merge.isAborted() == false) {
      count++;
    }
  }
  return count;
}

@cwperks cwperks changed the title RenamemergeThreadCount in ConcurrentMergeScheduler to avoid clashing with method of the same name Rename mergeThreadCount in ConcurrentMergeScheduler to avoid clashing with method of the same name Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mergeThreadCount is both a variable and a method in the ConcurrentMergeScheduler
1 participant