Creates Stopwatch around passed callable.

@param callable with invocation time would be measured
@return
321370
public static Stopwatch create(VoidCallable callable) {
        Stopwatch stopwatch = new Stopwatch();
        stopwatch.callable = callable;
        return stopwatch;
    }
1013052
public static <T> Callable<T> callable(CheckedCallable<T> callable) {
        return Unchecked.callable(callable, Unchecked.RETHROW_ALL);
    }
502214
@ReplacedBy("com.google.common.util.concurrent.Callables#returning()")
    public static <V> Callable<V> asCallable (final V value)
    {
        return new Callable<V>() {
            public V call () {
                return value;
            }
        };
    }
216275
public <T> T execute(final Callable<T> callable) throws Exception {
        int attempts = 0;
        int maxAttempts = retryPolicy.getMaxAttempts();
        long delay = retryPolicy.getDelay();
        TimeUnit timeUnit = retryPolicy.getTimeUnit();
        while(attempts < maxAttempts) {
            try {
                attempts++;
                beforeCall();
                T result = callable.call();
                afterCall(result);
                return result;
            } catch (Exception e) {
                onException(e);
                if (attempts >= maxAttempts) {
                    onMaxAttempts(e);
                    throw e;
                }
                beforeWait();
                sleep(timeUnit.toMillis(delay));
                afterWait();
            }
        }
        return null;
    }
954495
public static Stopwatch start(MonitorConfig config) {
    return INSTANCE.get(config, TimeUnit.MILLISECONDS).start();
  }
887928
public <T> T checkSucceeds(Callable<T> callable) {
        try {
            return callable.call();
        } catch (Throwable e) {
            addError(e);
            return null;
        }
    }
1087265
private CallTree initCallTree() {
		final CallTree callTree = new CallTree(logThreshold) {
			@Override
			protected void onRootStopwatchStop(CallTreeNode rootNode, Split split) {
				CallTreeCallback.this.onRootStopwatchStop(this, split);
			}
		};
		threadCallTree.set(callTree);
		return callTree;
	}
231698
@Nonnull
  public static TimeValue runMeasured (@Nonnull final Runnable aRunnable)
  {
    final StopWatch aSW = createdStarted ();
    aRunnable.run ();
    final long nNanos = aSW.stopAndGetNanos ();
    return new TimeValue (TimeUnit.NANOSECONDS, nNanos);
  }
533871
<T> T runInCompilerThread(Callable<T> callable) {
    return compilerExecutor.runInCompilerThread(
        callable, options != null && options.getTracerMode().isOn());
  }
199431
private function createReflection(callable $callable)
    {
        if (is_string($callable) && strpos($callable, '::')) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable)) {
            return new ReflectionMethod($callable[0], $callable[1]);
        }

        if (is_object($callable) && method_exists($callable, '__invoke')) {
            return new ReflectionMethod($callable, '__invoke');
        }

        return new ReflectionFunction($callable);
    }
555772
protected ScheduledFuture<?> startTimer() {
        return getExecutorService().scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                endOfPeriod();
            }
        }, getPeriod(), getPeriod(), getUnit());
    }
982344
@SuppressWarnings("unchecked")
		public <T,I> Collection<T> startWorking(Collection<Callable<I>> callables) 
		 {
			    List<Future<I>> list = new ArrayList<Future<I>>();
			    
			    for (Callable<I> callable : callables)
			    {
			    	list.add(executor.submit(callable));
			    }
			    
			   
			    ArrayList<T> resultList = new ArrayList<T>(callables.size());
			    
			    // Now retrieve the result
			    I output;
			    for (Future<I> future : list) 
			    {
			      try 
			      {  
			    	  output = future.get();
			    	  
			    	  if(output != null)
			    		  resultList.add((T)output);
			      } 
			      catch (InterruptedException e) 
			      {
			        throw new SystemException(e);
			      } 
			      catch (ExecutionException e) 
			      {
			    	  Throwable cause =  e.getCause();
			    	  if(cause == null)
			    		  cause = e;
			    	  if(cause instanceof RuntimeException)
			    		  throw (RuntimeException)cause;
			    		  
			    	  throw new SystemException(cause);
			      }
			    }
			    
			  return resultList;
		 }
743654
public R call(Callable<R> callable) throws ExecutionException, RetryException {
        return this.delegate(callable).call();
    }
387811
public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
        if (callable == null)
            throw new NullPointerException();
        return callable;
    }
20126
public <T> T act(ProcessCallable<T> callable) throws IOException, InterruptedException {
            return callable.invoke(this, FilePath.localChannel);
        }
301195
@SuppressWarnings("unchecked")
    public final T last() {
        if (this instanceof Callable) {
            return checkedCall((Callable<T>) this);
        }
        Iterator<T> it = iterator();
        if (!it.hasNext()) {
            throw new NoSuchElementException();
        }

        for (;;) {
            T t = it.next();
            if (!it.hasNext()) {
                return t;
            }
        }
    }
954873
static <T> Flowable<T> wrap(
            Publisher<T> source, Collection<ReactiveInstrumenter> instrumentations) {
        if (source instanceof Callable) {
            return new RxInstrumentedCallableFlowable<>(source, instrumentations);
        }
        return new RxInstrumentedFlowable<>(source, instrumentations);
    }