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

com.softicar.platform.common.core.thread.function.FunctionThread Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
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;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy