Tabnine Logo
Callable
Code IndexAdd Tabnine to your IDE (free)

How to use
Callable
in
java.util.concurrent

Best Java code snippets using java.util.concurrent.Callable (Showing top 20 results out of 18,279)

origin: ReactiveX/RxJava

  @Override
  public T call() throws Exception {
    return callable.call();
  }
}
origin: google/guava

 @Override
 public V load(Object key) throws Exception {
  return valueLoader.call();
 }
});
origin: spring-projects/spring-framework

@Override
public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
  return (timeoutCallback != null ? timeoutCallback.call() : CallableProcessingInterceptor.RESULT_NONE);
}
@Override
origin: spring-projects/spring-framework

@Override
public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
  return (errorCallback != null ? errorCallback.call() : CallableProcessingInterceptor.RESULT_NONE);
}
@Override
origin: jenkinsci/jenkins

protected <V> V _withLock(java.util.concurrent.Callable<V> callable) throws Exception {
  synchronized (this) {
    return callable.call();
  }
}
origin: google/guava

@Override
public ListenableFuture<T> call() throws Exception {
 return immediateFuture(callable.call());
}
origin: google/guava

 @Override
 public void run() {
  try {
   wrapped.call();
  } catch (Exception e) {
   throwIfUnchecked(e);
   throw new RuntimeException(e);
  }
 }
};
origin: google/guava

 @Override
 public T call() throws Exception {
  Thread currentThread = Thread.currentThread();
  String oldName = currentThread.getName();
  boolean restoreName = trySetName(nameSupplier.get(), currentThread);
  try {
   return callable.call();
  } finally {
   if (restoreName) {
    boolean unused = trySetName(oldName, currentThread);
   }
  }
 }
};
origin: ReactiveX/RxJava

  @Override
  public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
    return schedulerCallable.call();
  }
};
origin: ReactiveX/RxJava

  @Override
  public T call() throws Exception {
    return ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value");
  }
}
origin: ReactiveX/RxJava

  @Override
  public T call() throws Exception {
    return ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value");
  }
}
origin: square/retrofit

private synchronized Call<T> getDelegate() {
 Call<T> delegate = this.delegate;
 if (delegate == null) {
  try {
   delegate = callable.call();
  } catch (Exception e) {
   delegate = failure(e);
  }
  this.delegate = delegate;
 }
 return delegate;
}
origin: google/guava

 @Override
 public T call() throws Exception {
  return delegate.call();
 }
}
origin: google/guava

 @Override
 public T call() throws Exception {
  return delegate.call();
 }
}
origin: spring-projects/spring-framework

  @Override
  public Object apply(Object o) {
    try {
      return toStoreValue(this.valueLoader.call());
    }
    catch (Exception ex) {
      throw new ValueRetrievalException(o, this.valueLoader, ex);
    }
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public <T> T get(Object key, Callable<T> valueLoader) {
  try {
    return valueLoader.call();
  }
  catch (Exception ex) {
    throw new ValueRetrievalException(key, valueLoader, ex);
  }
}
origin: spring-projects/spring-framework

  @Override
  @Nullable
  public V call() throws Exception {
    try {
      return this.delegate.call();
    }
    catch (Throwable ex) {
      this.errorHandler.handleError(ex);
      return null;
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Obtain a {@link InputStream} from the given supplier, and read it into a {@code Flux}
 * of {@code DataBuffer}s. Closes the input stream when the flux is terminated.
 * @param inputStreamSupplier the supplier for the input stream to read from
 * @param dataBufferFactory the factory to create data buffers with
 * @param bufferSize the maximum size of the data buffers
 * @return a flux of data buffers read from the given channel
 */
public static Flux<DataBuffer> readInputStream(
    Callable<InputStream> inputStreamSupplier, DataBufferFactory dataBufferFactory, int bufferSize) {
  Assert.notNull(inputStreamSupplier, "'inputStreamSupplier' must not be null");
  return readByteChannel(() -> Channels.newChannel(inputStreamSupplier.call()), dataBufferFactory, bufferSize);
}
origin: square/retrofit

/** The HTTP error to be used when an error is triggered. */
public Response<?> createErrorResponse() {
 Response<?> call;
 try {
  call = errorFactory.call();
 } catch (Exception e) {
  throw new IllegalStateException("Error factory threw an exception.", e);
 }
 if (call == null) {
  throw new IllegalStateException("Error factory returned null.");
 }
 if (call.isSuccessful()) {
  throw new IllegalStateException("Error factory returned successful response.");
 }
 return call;
}
origin: jenkinsci/jenkins

  @Override
  public V call() throws Exception {
    try (ACLContext ctxt = ACL.as(authentication)) {
      return r.call();
    }
  }
};
java.util.concurrentCallable

Javadoc

A task that returns a result and may throw an exception. Implementors define a single method with no arguments called call.

The Callable interface is similar to java.lang.Runnable, in that both are designed for classes whose instances are potentially executed by another thread. A Runnable, however, does not return a result and cannot throw a checked exception.

The Executors class contains utility methods to convert from other common forms to Callable classes.

Most used methods

  • call
    Computes a result, or throws an exception if unable to do so.
  • <init>

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getSystemService (Context)
  • getApplicationContext (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now