Skip to content

Commit 27ecc8e

Browse files
jsorefjavanna
authored andcommitted
Spelling: replace interruptable with interruptible (#37049)
1 parent cb087b2 commit 27ecc8e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/TestClustersPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private static void configureCleanupHooks(Project project) {
311311
shutdownExecutorService();
312312
});
313313
// When the Daemon is not used, or runs into issues, rely on a shutdown hook
314-
// When the daemon is used, but does not work correctly and eventually dies off (e.x. due to non interruptable
314+
// When the daemon is used, but does not work correctly and eventually dies off (e.x. due to non interruptible
315315
// thread in the build) process will be stopped eventually when the daemon dies.
316316
Runtime.getRuntime().addShutdownHook(new Thread(TestClustersPlugin::shutDownAllClusters));
317317
}

server/src/main/java/org/elasticsearch/common/util/CancellableThreads.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/**
3131
* A utility class for multi threaded operation that needs to be cancellable via interrupts. Every cancellable operation should be
32-
* executed via {@link #execute(Interruptable)}, which will capture the executing thread and make sure it is interrupted in the case
32+
* executed via {@link #execute(Interruptible)}, which will capture the executing thread and make sure it is interrupted in the case
3333
* of cancellation.
3434
*
3535
* Cancellation policy: This class does not support external interruption via <code>Thread#interrupt()</code>. Always use #cancel() instead.
@@ -77,33 +77,33 @@ private synchronized boolean add() {
7777
}
7878

7979
/**
80-
* run the Interruptable, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread
80+
* run the Interruptible, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread
8181
* causing the call to prematurely return.
8282
*
83-
* @param interruptable code to run
83+
* @param interruptible code to run
8484
*/
85-
public void execute(Interruptable interruptable) {
85+
public void execute(Interruptible interruptible) {
8686
try {
87-
executeIO(interruptable);
87+
executeIO(interruptible);
8888
} catch (IOException e) {
89-
assert false : "the passed interruptable can not result in an IOException";
89+
assert false : "the passed interruptible can not result in an IOException";
9090
throw new RuntimeException("unexpected IO exception", e);
9191
}
9292
}
9393
/**
94-
* run the Interruptable, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread
94+
* run the Interruptible, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread
9595
* causing the call to prematurely return.
9696
*
97-
* @param interruptable code to run
97+
* @param interruptible code to run
9898
*/
99-
public void executeIO(IOInterruptable interruptable) throws IOException {
99+
public void executeIO(IOInterruptible interruptible) throws IOException {
100100
boolean wasInterrupted = add();
101101
boolean cancelledByExternalInterrupt = false;
102102
RuntimeException runtimeException = null;
103103
IOException ioException = null;
104104

105105
try {
106-
interruptable.run();
106+
interruptible.run();
107107
} catch (InterruptedException | ThreadInterruptedException e) {
108108
// ignore, this interrupt has been triggered by us in #cancel()...
109109
assert cancelled : "Interruption via Thread#interrupt() is unsupported. Use CancellableThreads#cancel() instead";
@@ -167,11 +167,11 @@ public synchronized void cancel(String reason) {
167167
}
168168

169169

170-
public interface Interruptable extends IOInterruptable {
170+
public interface Interruptible extends IOInterruptible {
171171
void run() throws InterruptedException;
172172
}
173173

174-
public interface IOInterruptable {
174+
public interface IOInterruptible {
175175
void run() throws IOException, InterruptedException;
176176
}
177177

server/src/main/java/org/elasticsearch/indices/recovery/RecoverySourceHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private boolean isTargetSameHistory() {
237237
return targetHistoryUUID != null && targetHistoryUUID.equals(shard.getHistoryUUID());
238238
}
239239

240-
static void runUnderPrimaryPermit(CancellableThreads.Interruptable runnable, String reason,
240+
static void runUnderPrimaryPermit(CancellableThreads.Interruptible runnable, String reason,
241241
IndexShard primary, CancellableThreads cancellableThreads, Logger logger) {
242242
cancellableThreads.execute(() -> {
243243
CompletableFuture<Releasable> permit = new CompletableFuture<>();
@@ -563,7 +563,7 @@ protected SendSnapshotResult sendSnapshot(final long startingSeqNo, long require
563563
logger.trace("no translog operations to send");
564564
}
565565

566-
final CancellableThreads.IOInterruptable sendBatch = () -> {
566+
final CancellableThreads.IOInterruptible sendBatch = () -> {
567567
final long targetCheckpoint = recoveryTarget.indexTranslogOperations(
568568
operations, expectedTotalOps, maxSeenAutoIdTimestamp, maxSeqNoOfUpdatesOrDeletes);
569569
targetLocalCheckpoint.set(targetCheckpoint);

server/src/test/java/org/elasticsearch/common/util/CancellableThreadsTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
package org.elasticsearch.common.util;
2020

21-
import org.elasticsearch.common.util.CancellableThreads.IOInterruptable;
22-
import org.elasticsearch.common.util.CancellableThreads.Interruptable;
21+
import org.elasticsearch.common.util.CancellableThreads.IOInterruptible;
22+
import org.elasticsearch.common.util.CancellableThreads.Interruptible;
2323
import org.elasticsearch.test.ESTestCase;
2424
import org.hamcrest.Matchers;
2525

@@ -62,7 +62,7 @@ private TestPlan(int id) {
6262
}
6363
}
6464

65-
static class TestRunnable implements Interruptable {
65+
static class TestRunnable implements Interruptible {
6666
final TestPlan plan;
6767
final CountDownLatch readyForCancel;
6868

@@ -95,7 +95,7 @@ public void run() throws InterruptedException {
9595
}
9696
}
9797

98-
static class TestIORunnable implements IOInterruptable {
98+
static class TestIORunnable implements IOInterruptible {
9999
final TestPlan plan;
100100
final CountDownLatch readyForCancel;
101101

0 commit comments

Comments
 (0)