All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.vipcxj.jasync.ng.runtime.schedule.ImmediateTask Maven / Gradle / Ivy

package io.github.vipcxj.jasync.ng.runtime.schedule;

import io.github.vipcxj.jasync.ng.spec.JContext;
import io.github.vipcxj.jasync.ng.spec.JThunk;

import java.util.function.BiConsumer;

public class ImmediateTask implements Task {

    private final BiConsumer, JContext> handler;

    public ImmediateTask(BiConsumer, JContext> handler) {
        this.handler = handler;
    }

    @Override
    public void schedule(JThunk thunk, JContext context) {
        try {
            handler.accept(thunk, context);
        } catch (Throwable t) {
            thunk.reject(t, context);
        }
    }

    @Override
    public void cancel() { }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy