com.link_intersystems.util.function.CallableRunnable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lis-commons-util Show documentation
Show all versions of lis-commons-util Show documentation
Link Intersystems Commons Util (lis-commons-util) is collection of reusable software components
that extend the standard java.util components.
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;
}
}