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

com.softicar.platform.common.core.thread.runner.ILimitedThreadRunner 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.runner;

import com.softicar.platform.common.core.thread.IRunnableThread;
import java.util.Collection;

/**
 * Interface to run queued {@link Runnable} objects by employing a limited
 * number of concurrent {@link Thread} instances.
 *
 * @param 
 *            the type of {@link Runnable} objects
 * @author Alexander Schmidt
 * @author Oliver Richers
 */
public interface ILimitedThreadRunner {

	/**
	 * Starts {@link Thread} instances for as many previously-added
	 * {@link Runnable} objects as possible, respecting the maximum number of
	 * concurrent {@link Thread} instances.
	 *
	 * @return all {@link IRunnableThread} instances started by this method call
	 */
	Collection> startThreads();

	/**
	 * Enqueues the given {@link Runnable} to be started as {@link Thread}
	 * later-on.
	 * 

* The given {@link Runnable} will not be started before * {@link #startThreads} was called. * * @param runnable * the {@link Runnable} to be added (never null) */ void addRunnable(R runnable); /** * Tests whether there are slots for new {@link Thread} instances to be * started. * * @return true if there are free slots for new {@link Thread} * instances to be started; false otherwise */ boolean hasAvailableSlots(); /** * Determines whether there are either running {@link Thread} instances * and/or queued {@link Runnable} objects. * * @return true if there are running threads or queue entries; * false otherwise */ boolean isFinished(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy