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

org.jboss.elemento.flow.Promisable Maven / Gradle / Ivy

Go to download

Parallel, sequential, repeated and nested execution of asynchronous tasks using promises.

There is a newer version: 1.6.10
Show newest version
/*
 *  Copyright 2023 Red Hat
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.jboss.elemento.flow;

import elemental2.promise.IThenable.ThenOnFulfilledCallbackFn;
import elemental2.promise.IThenable.ThenOnRejectedCallbackFn;
import elemental2.promise.Promise;
import elemental2.promise.Promise.CatchOnRejectedCallbackFn;
import elemental2.promise.Promise.FinallyOnFinallyCallbackFn;

/**
 * An interface to use the promise when executing {@linkplain Task asynchronous tasks}.
 * 

* Error Handling
* When using the methods in this interface, errors in tasks are propagated to the closest catch handler. This is different from * the methods in {@link Subscription} that catches errors in tasks and stores them in the {@linkplain FlowContext context}. * * @param the type of the {@linkplain FlowContext context} shared between tasks */ public interface Promisable { Promise then(ThenOnFulfilledCallbackFn onFulfilled); Promise then( ThenOnFulfilledCallbackFn onFulfilled, ThenOnRejectedCallbackFn onRejected); Promise catch_(CatchOnRejectedCallbackFn onRejected); Promise finally_(FinallyOnFinallyCallbackFn onFinally); /** * Returns the promise of the asynchronous execution. */ Promise promise(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy