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

blah.concurrency.second.DefaultJobDispatcher Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package blah.concurrency.second;

import java.util.concurrent.Executors;

public class DefaultJobDispatcher implements JobDispatcher {

	final int availableProcessors = Runtime.getRuntime().availableProcessors();
	final java.util.concurrent.ExecutorService executor;
	final JobQueue buffer;
	
	public DefaultJobDispatcher( int bufferSize ) {
		buffer = new JobQueue(bufferSize);
		executor = Executors.newFixedThreadPool( availableProcessors );
		initializeJobRunners();
	}

	void initializeJobRunners(){
		for ( int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy