package eu.dnetlib.services.async;

import java.util.Map;

import eu.dnetlib.exceptions.DnetGenericRuntimeException;

public abstract class AsyncRunnable implements Runnable {

	abstract public Map<String, String> prepare() throws AsyncMethodException;

	abstract public void execute() throws AsyncMethodException;

	@Override
	public final void run() {
		try {
			execute();
		} catch (final AsyncMethodException e) {
			throw new DnetGenericRuntimeException("Error executing async method", e);
		}
	}

}
