Correct promise naming convention

This commit is contained in:
tommyskeff
2023-11-19 21:44:26 +00:00
parent 08e97d81a4
commit 31f654544a

View File

@@ -89,14 +89,14 @@ public class Promise<T> {
}, delay, unit, Schedulers.getTrace(task)); }, delay, unit, Schedulers.getTrace(task));
} }
public @NotNull Promise<Void> thenAcceptSync(@NotNull ExceptionalConsumer<T> task) { public @NotNull Promise<Void> thenConsumeSync(@NotNull ExceptionalConsumer<T> task) {
return thenApplySync(result -> { return thenApplySync(result -> {
task.accept(result); task.accept(result);
return null; return null;
}, Schedulers.getTrace(task)); }, Schedulers.getTrace(task));
} }
public @NotNull Promise<Void> thenAcceptDelayedSync(@NotNull ExceptionalConsumer<T> task, long delay, @NotNull TimeUnit unit) { public @NotNull Promise<Void> thenConsumeDelayedSync(@NotNull ExceptionalConsumer<T> task, long delay, @NotNull TimeUnit unit) {
return thenApplyDelayedSync(result -> { return thenApplyDelayedSync(result -> {
task.accept(result); task.accept(result);
return null; return null;
@@ -153,7 +153,7 @@ public class Promise<T> {
public <V> @NotNull Promise<V> thenComposeSync(@NotNull ExceptionalFunction<T, @NotNull Promise<V>> task) { public <V> @NotNull Promise<V> thenComposeSync(@NotNull ExceptionalFunction<T, @NotNull Promise<V>> task) {
Promise<V> promise = new Promise<>(); Promise<V> promise = new Promise<>();
thenApplySync(task, Schedulers.getTrace(task)).thenAcceptAsync(nestedPromise -> { thenApplySync(task, Schedulers.getTrace(task)).thenConsumeAsync(nestedPromise -> {
nestedPromise.addListener(ctx1 -> { nestedPromise.addListener(ctx1 -> {
if (ctx1.isError()) { if (ctx1.isError()) {
//noinspection ConstantConditions //noinspection ConstantConditions
@@ -187,14 +187,14 @@ public class Promise<T> {
}, delay, unit, Schedulers.getTrace(task)); }, delay, unit, Schedulers.getTrace(task));
} }
public @NotNull Promise<Void> thenAcceptAsync(@NotNull ExceptionalConsumer<T> task) { public @NotNull Promise<Void> thenConsumeAsync(@NotNull ExceptionalConsumer<T> task) {
return thenApplyAsync(result -> { return thenApplyAsync(result -> {
task.accept(result); task.accept(result);
return null; return null;
}, Schedulers.getTrace(task)); }, Schedulers.getTrace(task));
} }
public @NotNull Promise<Void> thenAcceptDelayedAsync(@NotNull ExceptionalConsumer<T> task, long delay, @NotNull TimeUnit unit) { public @NotNull Promise<Void> thenConsumerDelayedAsync(@NotNull ExceptionalConsumer<T> task, long delay, @NotNull TimeUnit unit) {
return thenApplyDelayedAsync(result -> { return thenApplyDelayedAsync(result -> {
task.accept(result); task.accept(result);
return null; return null;
@@ -249,7 +249,7 @@ public class Promise<T> {
public <V> @NotNull Promise<V> thenComposeAsync(@NotNull ExceptionalFunction<T, Promise<V>> task) { public <V> @NotNull Promise<V> thenComposeAsync(@NotNull ExceptionalFunction<T, Promise<V>> task) {
Promise<V> promise = new Promise<>(); Promise<V> promise = new Promise<>();
thenApplyAsync(task, Schedulers.getTrace(task)).thenAcceptAsync(nestedPromise -> { thenApplyAsync(task, Schedulers.getTrace(task)).thenConsumeAsync(nestedPromise -> {
nestedPromise.addListener(ctx1 -> { nestedPromise.addListener(ctx1 -> {
if (ctx1.isError()) { if (ctx1.isError()) {
//noinspection ConstantConditions //noinspection ConstantConditions