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

org.eclipse.rdf4j.federated.evaluation.concurrent.Scheduler Maven / Gradle / Ivy

There is a newer version: 5.1.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2019 Eclipse RDF4J contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Distribution License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *******************************************************************************/
package org.eclipse.rdf4j.federated.evaluation.concurrent;

import org.eclipse.rdf4j.common.iteration.CloseableIteration;

/**
 * Interface for any scheduler.
 *
 * @author Andreas Schwarte
 *
 * @see ControlledWorkerScheduler
 */
public interface Scheduler {

	/**
	 * Schedule the provided task.
	 *
	 * @param task
	 */
	void schedule(ParallelTask task);

	/**
	 * Callback to handle the result.
	 *
	 * @param res
	 */
	void handleResult(CloseableIteration res);

	/**
	 * Inform the scheduler that a certain task is done.
	 *
	 */
	void done();

	/**
	 * Toss an exception to the scheduler.
	 *
	 * @param e
	 */
	void toss(Exception e);

	/**
	 * Abort the execution of running and queued tasks.
	 *
	 */
	void abort();

	void shutdown();

	/**
	 * Inform the scheduler that no more tasks will be scheduled.
	 */
	void informFinish();

	/**
	 * Determine if the scheduler has unfinished tasks.
	 *
	 * @return whether the scheduler is running
	 */
	boolean isRunning();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy