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

com.softicar.platform.common.core.retry.RetryingSupplier 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.retry;

import java.util.function.Supplier;

/**
 * Utility class to retry the execution of a {@link Supplier}.
 *
 * @author Oliver Richers
 */
public class RetryingSupplier extends AbstractRetrier> implements Supplier {

	private final Supplier supplier;
	private T result;

	public RetryingSupplier(Supplier supplier) {

		this.supplier = supplier;
	}

	/**
	 * Starts the execution of the retry loop and returns the result.
	 */
	@Override
	public T get() {

		executeRetryLoop();
		return result;
	}

	@Override
	protected void executeTry() {

		this.result = supplier.get();
	}

	@Override
	protected RetryingSupplier getThis() {

		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy