ExecutorServiceManager.java
01 /*
02  * Copyright 2008-2016 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package griffon.core;
17 
18 import javax.annotation.Nonnull;
19 import javax.annotation.Nullable;
20 import java.util.Collection;
21 import java.util.concurrent.ExecutorService;
22 
23 /**
24  @author Andres Almiray
25  @since 2.0.0
26  */
27 public interface ExecutorServiceManager {
28     /**
29      * Returns an immutable view of all {@code ExecutorService}s currently managed.
30      *
31      @return a collection of all {@code ExecutorService}s or empty if none.
32      @since 2.4.0
33      */
34     @Nonnull
35     Collection<ExecutorService> getExecutorServices();
36 
37     @Nullable
38     ExecutorService add(@Nullable ExecutorService executorService);
39 
40     @Nullable
41     ExecutorService remove(@Nullable ExecutorService executorService);
42 
43     void shutdownAll();
44 }