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

io.datakernel.async.callback.Callback Maven / Gradle / Ivy

package io.datakernel.async.callback;

import io.datakernel.eventloop.Eventloop;
import org.jetbrains.annotations.Nullable;

/**
 * Represents a universal Callback interface
 */
@FunctionalInterface
public interface Callback {
	/**
	 * Performs action upon of completion of Completable computation
	 */
	void accept(T result, @Nullable Throwable e);

	static  Callback toAnotherEventloop(Eventloop anotherEventloop, Callback cb) {
		return (result, e) -> anotherEventloop.execute(() -> cb.accept(result, e));
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy