io.github.vipcxj.jasync.ng.spec.spi.JPromiseSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasync-spec Show documentation
Show all versions of jasync-spec Show documentation
JAsync implements Async-Await fashion for Java just like es and c#.
This library provide the spec of all public api.
package io.github.vipcxj.jasync.ng.spec.spi;
import io.github.vipcxj.jasync.ng.spec.*;
import io.github.vipcxj.jasync.ng.spec.functional.JAsyncPortalTask1;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
public interface JPromiseSupport extends PrioritySupport {
JPromise just(T value);
JPromise error(Throwable error);
JPromise sleep(long time, TimeUnit unit);
JPromise portal(JAsyncPortalTask1 task);
JPromise any(List> promises);
@SuppressWarnings("unchecked")
default JPromise any(JPromise extends T>... promises) {
return any(Arrays.asList(promises));
}
JPromise race(List> promises);
@SuppressWarnings("unchecked")
default JPromise race(JPromise extends T>... promises) {
return race(Arrays.asList(promises));
}
JPromise> all(List> promises);
@SuppressWarnings("unchecked")
default JPromise> all(JPromise extends T>... promises) {
return all(Arrays.asList(promises));
}
JPromise create(BiConsumer, JContext> handler);
JPromise generate(BiConsumer, JContext> handler);
JPromiseTrigger createTrigger();
int generateId();
JAsyncReadWriteLock readWriteLock();
}