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.Collections;
18 import java.util.List;
19
20 /**
21 * A implementation of {@link ExecutorManager} that do nothing.
22 *
23 * @author Zardi (https://sourceforge.net/users/daniel_zardi)
24 * @version 1.0.0
25 * @since 1.0.0
26 */
27 public class EmptyExecutorManager implements ExecutorManager {
28
29 /**
30 * The identifier of this executor manager.
31 */
32 private String identifier;
33
34 /**
35 * Constructs a new EmptyExecutorManager with the supplied identifier.
36 *
37 * @param identifier
38 * A string that identifies this executor manager.
39 * @since 1.0.0
40 */
41 public EmptyExecutorManager(String identifier) {
42 setIdentifier(identifier);
43 }
44
45 /** {@inheritDoc} */
46 public final String getIdentifier() {
47 return identifier;
48 }
49
50 /**
51 * Sets the string that identifies this object.
52 *
53 * @param identifier
54 * The identifier of this object.
55 * @since 1.0.0
56 */
57 private void setIdentifier(String identifier) {
58 if (identifier == null) {
59 this.identifier = "";
60 } else {
61 this.identifier = identifier;
62 }
63 }
64
65 /** {@inheritDoc} */
66 public void execute(Runnable command) {
67 // REMARK: Intentionally left blank.
68 }
69
70 /** {@inheritDoc} */
71 public void executeAll(List<Runnable> commands) {
72 // REMARK: Intentionally left blank.
73 }
74
75 /** {@inheritDoc} */
76 public boolean isTerminated() {
77 // FIXME: use a property to control this
78 return true;
79 }
80
81 /** {@inheritDoc} */
82 public boolean orderProperShutdown() {
83 // FIXME: set the property
84 return true;
85 }
86
87 /** {@inheritDoc} */
88 public boolean awaitTermination(long terminationTimeout) {
89 // FIXME: use a property to control this
90 // TODO: should this check for a illegal state? this can be called only after shutdown
91 return true;
92 }
93
94 /** {@inheritDoc} */
95 public List<Runnable> terminateAndRetrieveTasks() {
96 // FIXME: use a property to control termination
97 // TODO: should this check for a illegal state? this can be called only after shutdown
98 return Collections.emptyList();
99 }
100
101 }