de.intarsys.tools.lang.CallableAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isrt Show documentation
Show all versions of isrt Show documentation
The basic runtime tools and interfaces for intarsys components.
package de.intarsys.tools.lang;
import java.util.concurrent.Callable;
abstract public class CallableAdapter implements Runnable, Callable {
private T result = null;
private Exception exception;
public T getResult() throws Exception {
if (exception != null) {
throw exception;
}
return result;
}
public T getResultUnchecked() {
if (exception != null) {
return null;
}
return result;
}
@Override
public void run() {
try {
setResult(call());
} catch (Exception e) {
exception = e;
}
}
protected void setResult(T result) {
this.result = result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy