ru.tinkoff.kora.common.util.flow.FromCallablePublisher Maven / Gradle / Ivy
package ru.tinkoff.kora.common.util.flow;
import ru.tinkoff.kora.common.Context;
import java.util.concurrent.Callable;
import java.util.concurrent.Flow;
public class FromCallablePublisher implements Flow.Publisher {
private final Context context;
private final Callable value;
public FromCallablePublisher(Context context, Callable value) {
this.context = context;
this.value = value;
}
@Override
public void subscribe(Flow.Subscriber super T> subscriber) {
var s = new LazySingleSubscription<>(subscriber, context, value);
subscriber.onSubscribe(s);
}
public final Callable callable() {
return this.value;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy