1 /*
2 * This file is part of AceLogger.
3 *
4 * AceLogger is free software: you can redistribute it and/or modify it under the terms of the GNU
5 * Lesser General Public License as published by the Free Software Foundation, either version 3 of
6 * the License, or (at your option) any later version.
7 *
8 * AceLogger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public License along with AceLogger.
13 * If not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
14 */
15 package net.sourceforge.acelogger.execution.manager;
16
17 import java.util.concurrent.Executors;
18
19 import net.sourceforge.acelogger.execution.DaemonThreadFactory;
20
21 /**
22 * An implementation of {@link ExecutorManager} that runs tasks asynchronously, so the caller do not
23 * get blocked until task completion. The execution order is <strong>NOT</strong> guaranteed because
24 * of the thread pool used for task execution. The tasks waits in a queue before they're executed by
25 * one of the threads of the pool.
26 *
27 * @author Zardi (https://sourceforge.net/users/daniel_zardi)
28 * @version 1.0.0
29 * @since 1.0.0
30 */
31 public class PooledExecutorManager extends BaseUtilConcurrentExecutorManager {
32
33 /**
34 * Constructs a new PooledExecutorManager with the supplied identifier and the maximum number of
35 * threads used for execution.
36 *
37 * @param identifier
38 * The string that identifies this executor manager.
39 * @param poolSize
40 * The maximum numbers of threads in the pool of this executor.
41 * @since 1.0.0
42 */
43 public PooledExecutorManager(String identifier, int poolSize) {
44 super(identifier, Executors.newFixedThreadPool(poolSize,
45 new DaemonThreadFactory(identifier)));
46 }
47
48 }