Skip to content

Instantly share code, notes, and snippets.

View gotterdemarung's full-sized avatar

Антон Дорофеев gotterdemarung

View GitHub Profile
@gotterdemarung
gotterdemarung / LimitedExecutorServiceWrapper.java
Created July 7, 2023 05:18 — forked from alexkasko/LimitedExecutorServiceWrapper.java
ExecutorService wrapper, limits max parallel threads
/**
* {@link ExecutorService} wrapper, limit max parallel threads to provided limit.
* May be useful for task with different parrallelism over the same executor.
*
* @author alexkasko
* Date: 7/6/12
*/
public class LimitedExecutorServiceWrapper implements ExecutorService {
private final ExecutorService target;
private final Semaphore semaphore;