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

com.link_intersystems.util.function.CallableRunnable Maven / Gradle / Ivy

package com.link_intersystems.util.function;

import java.util.concurrent.Callable;

/**
 * Adapts a callable to a {@link Runnable}.
 *
 * @param 
 */
public class CallableRunnable implements Runnable {

    private R result;
    private Callable callable;

    public CallableRunnable(Callable callable) {
        this.callable = callable;
    }

    @Override
    public void run() {
        try {
            result = callable.call();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public R getResult() {
        return result;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy