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;
}
}