com.softicar.platform.common.core.thread.function.FunctionThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.thread.function;
import java.util.function.Function;
public class FunctionThread extends Thread {
private final Function function;
private final T input;
private R result;
private Exception exception;
public FunctionThread(Function function, T input) {
this.function = function;
this.input = input;
}
public Exception getException() {
return exception;
}
public T getInput() {
return input;
}
public R getResult() {
return result;
}
@Override
public void run() {
try {
this.result = function.apply(input);
} catch (Exception exception) {
this.exception = exception;
}
}
}