Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ExecutorServiceProvider.java « util « deck « nextcloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc5e30bac2834fb414f4e7e24540e757800b3474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package it.niedermann.nextcloud.deck.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * If we really want <strong>this</strong>, we should default to {@link Executors#newWorkStealingPool()}.
 * Though I recommend to distinguish between blocking threads and non-blocking threads (like network operations), where it does not make sense to limit it to available CPU cores.
 */
//@Deprecated(forRemoval = true)
public class ExecutorServiceProvider {

//    private static final int NUMBER_OF_CORES = Runtime.getRuntime().availableProcessors();

    private static final ExecutorService EXECUTOR =
            Executors.newWorkStealingPool();
//            new ThreadPoolExecutor(NUMBER_OF_CORES>>1, NUMBER_OF_CORES,
//                60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

    private ExecutorServiceProvider() {
        // hide Constructor
    }

    public static ExecutorService getExecutorService() {
        return EXECUTOR;
    }
}