This project has retired. For details please refer to its Attic page.
NoOpExecutorService xref
View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package com.yammer.metrics.core;
20  
21  import java.util.Collection;
22  import java.util.List;
23  import java.util.concurrent.Callable;
24  import java.util.concurrent.ExecutionException;
25  import java.util.concurrent.Future;
26  import java.util.concurrent.ScheduledExecutorService;
27  import java.util.concurrent.ScheduledFuture;
28  import java.util.concurrent.TimeUnit;
29  import java.util.concurrent.TimeoutException;
30  
31  /**
32   * An executor service that does nothing. Used with empty metrics so that no
33   * threads are created wasting time / space.
34   */
35  public class NoOpExecutorService implements ScheduledExecutorService {
36    @Override
37    public ScheduledFuture<?> schedule(Runnable runnable, long l,
38                                       TimeUnit timeUnit) {
39      return null;
40    }
41  
42    @Override
43    public <V> ScheduledFuture<V> schedule(Callable<V> vCallable, long l,
44                                           TimeUnit timeUnit) {
45      return null;
46    }
47  
48    @Override
49    public ScheduledFuture<?> scheduleAtFixedRate(
50      Runnable runnable, long l, long l1, TimeUnit timeUnit
51    ) {
52      return null;
53    }
54  
55    @Override
56    public ScheduledFuture<?> scheduleWithFixedDelay(
57      Runnable runnable, long l, long l1, TimeUnit timeUnit
58    ) {
59      return null;
60    }
61  
62    @Override
63    public void shutdown() {
64    }
65  
66    @Override
67    public List<Runnable> shutdownNow() {
68      return null;
69    }
70  
71    @Override
72    public boolean isShutdown() {
73      return false;
74    }
75  
76    @Override
77    public boolean isTerminated() {
78      return false;
79    }
80  
81    @Override
82    public boolean awaitTermination(long l, TimeUnit timeUnit)
83      throws InterruptedException {
84      return false;
85    }
86  
87    @Override
88    public <T> Future<T> submit(Callable<T> tCallable) {
89      return null;
90    }
91  
92    @Override
93    public <T> Future<T> submit(Runnable runnable, T t) {
94      return null;
95    }
96  
97    @Override
98    public Future<?> submit(Runnable runnable) {
99      return null;
100   }
101 
102   @Override
103   public <T> List<Future<T>> invokeAll(
104     Collection<? extends Callable<T>> callables)
105     throws InterruptedException {
106     return null;
107   }
108 
109   @Override
110   public <T> List<Future<T>> invokeAll(
111     Collection<? extends Callable<T>> callables, long l, TimeUnit timeUnit
112   ) throws InterruptedException {
113     return null;
114   }
115 
116   @Override
117   public <T> T invokeAny(Collection<? extends Callable<T>> callables)
118     throws InterruptedException, ExecutionException {
119     return null;
120   }
121 
122   @Override
123   public <T> T invokeAny(Collection<? extends Callable<T>> callables, long l,
124                          TimeUnit timeUnit)
125     throws InterruptedException, ExecutionException, TimeoutException {
126     return null;
127   }
128 
129   @Override
130   public void execute(Runnable runnable) {
131   }
132 }