3939 */
4040package org .glassfish .jersey .tests .e2e ;
4141
42+ import java .util .Collection ;
4243import java .util .List ;
4344import java .util .Set ;
45+ import java .util .concurrent .Callable ;
46+ import java .util .concurrent .ExecutionException ;
4447import java .util .concurrent .ExecutorService ;
4548import java .util .concurrent .Executors ;
4649import java .util .concurrent .Future ;
50+ import java .util .concurrent .TimeUnit ;
51+ import java .util .concurrent .TimeoutException ;
4752import java .util .concurrent .atomic .AtomicBoolean ;
4853
4954import javax .ws .rs .GET ;
7176import static org .junit .Assert .assertEquals ;
7277
7378import jersey .repackaged .com .google .common .collect .Sets ;
74- import jersey .repackaged .com .google .common .util .concurrent .ForwardingExecutorService ;
7579import jersey .repackaged .com .google .common .util .concurrent .ThreadFactoryBuilder ;
7680
7781/**
@@ -158,7 +162,7 @@ public void dispose(final ExecutorService executorService) {
158162 executorService .shutdownNow ();
159163 }
160164
161- private class CustomExecutorService extends ForwardingExecutorService {
165+ private class CustomExecutorService implements ExecutorService {
162166
163167 private final ExecutorService delegate ;
164168 private final AtomicBoolean isCleanedUp ;
@@ -174,21 +178,68 @@ public CustomExecutorService() {
174178 executors .add (this );
175179 }
176180
177- @ Override
178- protected ExecutorService delegate () {
179- return delegate ;
180- }
181-
182181 @ Override
183182 public void shutdown () {
184183 tryCleanUp ();
185- super .shutdown ();
184+ delegate .shutdown ();
186185 }
187186
188187 @ Override
189188 public List <Runnable > shutdownNow () {
190189 tryCleanUp ();
191- return super .shutdownNow ();
190+ return delegate .shutdownNow ();
191+ }
192+
193+ @ Override
194+ public boolean isShutdown () {
195+ return delegate .isShutdown ();
196+ }
197+
198+ @ Override
199+ public boolean isTerminated () {
200+ return delegate .isTerminated ();
201+ }
202+
203+ @ Override
204+ public boolean awaitTermination (long timeout , TimeUnit unit ) throws InterruptedException {
205+ return delegate .awaitTermination (timeout , unit );
206+ }
207+
208+ @ Override
209+ public <T > Future <T > submit (Callable <T > task ) {
210+ return delegate .submit (task );
211+ }
212+
213+ @ Override
214+ public <T > Future <T > submit (Runnable task , T result ) {
215+ return delegate .submit (task , result );
216+ }
217+
218+ @ Override
219+ public Future <?> submit (Runnable task ) {
220+ return delegate .submit (task );
221+ }
222+
223+ @ Override
224+ public <T > List <Future <T >> invokeAll (Collection <? extends Callable <T >> tasks ) throws InterruptedException {
225+ return delegate .invokeAll (tasks );
226+ }
227+
228+ @ Override
229+ public <T > List <Future <T >> invokeAll (Collection <? extends Callable <T >> tasks , long timeout , TimeUnit unit )
230+ throws InterruptedException {
231+ return delegate .invokeAll (tasks , timeout , unit );
232+ }
233+
234+ @ Override
235+ public <T > T invokeAny (Collection <? extends Callable <T >> tasks ) throws InterruptedException , ExecutionException {
236+ return delegate .invokeAny (tasks );
237+ }
238+
239+ @ Override
240+ public <T > T invokeAny (Collection <? extends Callable <T >> tasks , long timeout , TimeUnit unit )
241+ throws InterruptedException , ExecutionException , TimeoutException {
242+ return delegate .invokeAny (tasks , timeout , unit );
192243 }
193244
194245 private void tryCleanUp () {
@@ -197,6 +248,11 @@ private void tryCleanUp() {
197248 executorReleaseCount ++;
198249 }
199250 }
251+
252+ @ Override
253+ public void execute (Runnable command ) {
254+ delegate .execute (command );
255+ }
200256 }
201257 }
202258
0 commit comments