Skip to content

Commit

Permalink
Rename allowedExecutors args
Browse files Browse the repository at this point in the history
  • Loading branch information
henningandersen committed Aug 8, 2024
1 parent 37fed31 commit 247d7c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,12 @@ private boolean assertCompleteAllowed() {
}

// only used in assertions
boolean allowedExecutors(Thread thread1, Thread thread2) {
boolean allowedExecutors(Thread blockedThread, Thread completingThread) {
// this should only be used to validate thread interactions, like not waiting for a future completed on the same
// executor, hence calling it with the same thread indicates a bug in the assertion using this.
assert thread1 != thread2 : "only call this for different threads";
String thread1Name = EsExecutors.executorName(thread1);
String thread2Name = EsExecutors.executorName(thread2);
assert blockedThread != completingThread : "only call this for different threads";
String thread1Name = EsExecutors.executorName(blockedThread);
String thread2Name = EsExecutors.executorName(completingThread);
return thread1Name == null || thread2Name == null || thread1Name.equals(thread2Name) == false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public UnsafePlainActionFuture(String unsafeExecutor, String unsafeExecutor2) {
}

@Override
boolean allowedExecutors(Thread thread1, Thread thread2) {
return super.allowedExecutors(thread1, thread2)
|| unsafeExecutor.equals(EsExecutors.executorName(thread1))
|| unsafeExecutor2.equals(EsExecutors.executorName(thread1));
boolean allowedExecutors(Thread blockedThread, Thread completingThread) {
return super.allowedExecutors(blockedThread, completingThread)
|| unsafeExecutor.equals(EsExecutors.executorName(blockedThread))
|| unsafeExecutor2.equals(EsExecutors.executorName(blockedThread));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
public class TestPlainActionFuture<T> extends PlainActionFuture<T> {
@Override
boolean allowedExecutors(Thread thread1, Thread thread2) {
boolean allowedExecutors(Thread blockedThread, Thread completingThread) {
return true;
}
}

0 comments on commit 247d7c7

Please sign in to comment.