Calls the callable and if it returns a value, the Try is successful with that value or if throws
and exception the Try captures that

@param callable the code to call
@param <V>      the value type

@return a Try which is the result of the call
776454
public static <V> Try<V> tryCall(Callable<V> callable) {
        try {
            return Try.succeeded(callable.call());
        } catch (Exception e) {
            return Try.failed(e);
        }
    }
524823
@Override
    public V call() throws Exception {
        Object captured = capturedRef.get();
        if (captured == null || releaseTtlValueReferenceAfterCall && !capturedRef.compareAndSet(captured, null)) {
            throw new IllegalStateException("TTL value reference is released after call!");
        }

        Object backup = replay(captured);
        try {
            return callable.call();
        } finally {
            restore(backup);
        }
    }
887928
public <T> T checkSucceeds(Callable<T> callable) {
        try {
            return callable.call();
        } catch (Throwable e) {
            addError(e);
            return null;
        }
    }
909882
@CanIgnoreReturnValue
  public <V> V call(Callable<V> c) throws Exception {
    Context previous = attach();
    try {
      return c.call();
    } finally {
      detach(previous);
    }
  }
489108
private static Object tryCall(String methodName, Throwing.Supplier<Object> supplier) {
		try {
			return supplier.get();
		} catch (Throwable error) {
			return new CallException(methodName, error);
		}
	}
819840
def callable_validator(v: Any) -> AnyCallable:
    
    if callable(v):
        return v

    raise errors.CallableError(value=v)
255041
public static <TResult> Task<TResult> call(final Callable<TResult> callable) {
    return call(callable, IMMEDIATE_EXECUTOR, null);
  }
20126
public <T> T act(ProcessCallable<T> callable) throws IOException, InterruptedException {
            return callable.invoke(this, FilePath.localChannel);
        }
127074
public static function invokeCallable($callable, $args = null)
    {
        if (null != $args) {
            if (is_array($args)) {
                $results = call_user_func_array($callable, $args);
            } else {
                $results = call_user_func($callable, $args);
            }
        } else {
            $results = call_user_func($callable);
        }

        return $results;
    }
1054026
def build(self, callable: Callable) -> Callable[..., CaptureResult]:
        
        def capturing_callable(*args, **kwargs) -> CaptureResult:
            return CaptureResult(return_value=callable(*args, **kwargs))

        if self.capture_exceptions:
            # Need to capture exceptions first else other (non-return) captured information will be lost
            exceptions_wrapper = CaptureWrapBuilder._create_capture_exceptions(self.capture_exceptions)
            capturing_callable = CaptureWrapBuilder._wrap(capturing_callable, exceptions_wrapper)
        if self.capture_stdout:
            capturing_callable = CaptureWrapBuilder._wrap(capturing_callable, CaptureWrapBuilder._capture_stdout)
        if self.capture_stderr:
            capturing_callable = CaptureWrapBuilder._wrap(capturing_callable, CaptureWrapBuilder._capture_stderr)

        return capturing_callable
387811
public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
        if (callable == null)
            throw new NullPointerException();
        return callable;
    }
119811
public static <T> Callable<T> loggingDecorator(Callable<T> callable) {
    if (callable instanceof MDCPropagatingCallable) {
      return callable;
    }
    return new MDCPropagatingCallable<T>(callable);
  }
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;
		 }
1294135
public static <T> CompletableFuture<T> failed(Throwable throwable) {

        LettuceAssert.notNull(throwable, "Throwable must not be null");

        CompletableFuture<T> future = new CompletableFuture<>();
        future.completeExceptionally(throwable);

        return future;
    }
572262
public static Throwable getUltimateCause(final Throwable throwable) {
    if (throwable.getCause() == null) {
      return throwable;
    } else {
      return getUltimateCause(throwable.getCause());
    }
  }
1199319
@SuppressWarnings("UnusedDeclaration")
    public static Object methodCall(Class<?> type, String methodName, Object[] args, Class<?>[] sig,
                                    String returnTypeAsString) throws Throwable {
        return doMethodCall(type, methodName, args, sig, returnTypeAsString);
    }
72310
<T> T callWithRetries(Callable<T> callable, RecurringPolicy<?> recurringPolicy,
      RecurringStats retryStats, Set<Class<? extends Exception>> retryableExceptions,
      boolean recoverable, boolean logFailures) throws Exception {
    boolean recovery = retryStats != null;

    while (true) {
      try {
        return callable.call();
      } catch (Exception e) {
        ShutdownSignalException sse = extractCause(e, ShutdownSignalException.class);
        if (sse == null && logFailures && recurringPolicy != null
            && recurringPolicy.allowsAttempts())
          log.error("Invocation of {} failed.", callable, e);

        if (sse != null && (recovery || !recoverable))
          throw e;

        if (!closed) {
          try {
            // Retry on channel recovery failure or retryable exception
            boolean retryable =
                recurringPolicy != null && recurringPolicy.allowsAttempts()
                    && isRetryable(retryableExceptions, e, sse);
            long startTime = System.nanoTime();

            if (retryable) {
              if (retryStats == null) 
                retryStats = new RecurringStats(recurringPolicy);
                
              // Wait for pending recovery
              if (sse != null) {
                if (recurringPolicy.getMaxDuration() == null)
                  circuit.await();
                else if (!circuit.await(retryStats.getMaxWaitTime())) {
                  log.debug("Exceeded max wait time while waiting for {} to recover", this);
                  throw e;
                }
              }

              // Continue retries
              retryStats.incrementAttempts();
              if (!retryStats.isPolicyExceeded()) {
                long remainingWaitTime =
                    retryStats.getWaitTime().toNanos() - (System.nanoTime() - startTime);
                if (remainingWaitTime > 0)
                  retryWaiter.await(Duration.nanos(remainingWaitTime));
                continue;
              }
            }
          } catch (Throwable ignore) {
          }
        }

        throw e;
      }
    }
  }