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

fr.profi.mzdb.util.concurrent.CallableCallback Maven / Gradle / Ivy

There is a newer version: 0.0.27
Show newest version
package fr.profi.mzdb.util.concurrent;

import java.util.concurrent.Callable;

/**
 * @author JeT
 *
 */
public class CallableCallback implements Callable {

	private final Callable callable;
	private final Callback callback;

	/**
	 * @param callback
	 */
	public CallableCallback(Callable callable, Callback callback) {
		super();
		this.callable = callable;
		this.callback = callback;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.util.concurrent.Callable#call()
	 */
	@Override
	public V call() throws Exception {
		V result = this.callable.call();
		if (this.callback != null) {
			this.callback.onCompletion(result);
		}
		return result;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy