Skip to content

Commit 660fcd7

Browse files
committed
Rename Completion::wrap to toRun
1 parent 1fb28ec commit 660fcd7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

mug/src/main/java/com/google/mu/util/concurrent/Completion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ final class Completion implements AutoCloseable {
2121
private final Phaser phaser = new Phaser(1);
2222

2323
void run(Runnable task) {
24-
wrap(task).run();
24+
toRun(task).run();
2525
}
2626

27-
Runnable wrap(Runnable task) {
27+
Runnable toRun(Runnable task) {
2828
phaser.register();
2929
return () -> {
3030
try {

mug/src/main/java/com/google/mu/util/concurrent/Fanout.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,17 +481,17 @@ Scope add(Runnable... tasks) {
481481
}
482482

483483
void run() throws StructuredConcurrencyInterruptedException {
484-
try (Completion completion = new Completion()){
485-
withUnlimitedConcurrency().parallelize(runnables.stream().map(completion::wrap));
484+
try (Completion completion = new Completion()) {
485+
withUnlimitedConcurrency().parallelize(runnables.stream().map(completion::toRun));
486486
} catch (InterruptedException e) {
487487
throw new StructuredConcurrencyInterruptedException(e);
488488
}
489489
}
490490

491491
@Deprecated
492492
void runUninterruptibly() {
493-
try (Completion completion = new Completion()){
494-
withUnlimitedConcurrency().parallelizeUninterruptibly(runnables.stream().map(completion::wrap));
493+
try (Completion completion = new Completion()) {
494+
withUnlimitedConcurrency().parallelizeUninterruptibly(runnables.stream().map(completion::toRun));
495495
}
496496
}
497497
}

mug/src/test/java/com/google/mu/util/concurrent/CompletionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class CompletionTest {
3636
AtomicBoolean done = new AtomicBoolean();
3737
try (Completion completion = new Completion()) {
3838
completion.run(() -> {});
39-
new Thread(completion.wrap(() -> {
39+
new Thread(completion.toRun(() -> {
4040
done.set(true);
4141
})).start();
4242
}
@@ -46,7 +46,7 @@ public class CompletionTest {
4646
@Test public void twoTasks_failed() throws Exception {
4747
AtomicBoolean done = new AtomicBoolean();
4848
try (Completion completion = new Completion()) {
49-
new Thread(completion.wrap(() -> {
49+
new Thread(completion.toRun(() -> {
5050
done.set(true);
5151
})).start();
5252
completion.run(() -> {

0 commit comments

Comments
 (0)