Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2012 Ness Computing, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.nesscomputing.concurrent;
 
 import java.util.List;
 
 
 {
     private final ExecutorService wrappedExcutorService;
     private final CallableWrapper wrapper;
 
     DecoratingExecutorService(final ExecutorService wrappedExecutorServicefinal CallableWrapper wrapper)
     {
         super(wrappedExecutorService);
         this. = wrappedExecutorService;
         this. = wrapper;
     }
 
     @Override
     public void execute(final Runnable command)
     {
         .execute(.wrap(command));
     }
 
     @Override
     public <T> Future<T> submit(final Callable<T> task)
     {
         return .submit(.wrap(task));
     }
 
     @Override
     public <T> Future<T> submit(final Runnable taskfinal T result)
     {
         return .submit(.wrap(task),result);
     }
 
     @Override
     public Future<?> submit(final Runnable task)
     {
         return .submit(.wrap(task));
     }
 
     @Override
     public <T> List<Future<T>> invokeAll(final Collection<? extends Callable<T>> tasksthrows InterruptedException
     {
         Preconditions.checkArgument(tasks != null"collection of tasks can not be null!");
         return .invokeAll(meatify(tasks));
 
     }
 
     @Override
     public <T> List<Future<T>> invokeAll(final Collection<? extends Callable<T>> tasksfinal long timeoutfinal TimeUnit unitthrows InterruptedException
     {
         Preconditions.checkArgument(tasks != null"collection of tasks can not be null!");
         return .invokeAll(meatify(tasks), timeoutunit);
     }
 
     @Override
     public <T> T invokeAny(final Collection<? extends Callable<T>> tasksthrows InterruptedExceptionExecutionException
     {
         return .invokeAny(meatify(tasks));
     }
 
     @Override
     public <T> T invokeAny(final Collection<? extends Callable<T>> tasksfinal long timeoutfinal TimeUnit unitthrows InterruptedExceptionExecutionExceptionTimeoutException
     {
         return .invokeAny(meatify(tasks), timeoutunit);
     }
 
     private <T> Collection<Callable<T>> meatify(final Collection<? extends Callable<T>> callables)
     {
         return Collections2.transform(callablesnew Function<Callable<T>, Callable<T>>() {
             @Override
             public Callable<T> apply(final Callable<T> input) {
                 return .wrap(input);
            }
        });
    }
New to GrepCode? Check out our FAQ X