@Override public T call() throws Exception { return callable.call(); } }
@Override public V load(Object key) throws Exception { return valueLoader.call(); } });
@Override public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception { return (timeoutCallback != null ? timeoutCallback.call() : CallableProcessingInterceptor.RESULT_NONE); } @Override
@Override public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception { return (errorCallback != null ? errorCallback.call() : CallableProcessingInterceptor.RESULT_NONE); } @Override
protected <V> V _withLock(java.util.concurrent.Callable<V> callable) throws Exception { synchronized (this) { return callable.call(); } }
@Override public ListenableFuture<T> call() throws Exception { return immediateFuture(callable.call()); }
@Override public void run() { try { wrapped.call(); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } } };
@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); } } } };
@Override public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception { return schedulerCallable.call(); } };
@Override public T call() throws Exception { return ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value"); } }
@Override public T call() throws Exception { return ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value"); } }
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; }
@Override public T call() throws Exception { return delegate.call(); } }
@Override public T call() throws Exception { return delegate.call(); } }
@Override public Object apply(Object o) { try { return toStoreValue(this.valueLoader.call()); } catch (Exception ex) { throw new ValueRetrievalException(o, this.valueLoader, ex); } } }
@Override @Nullable public <T> T get(Object key, Callable<T> valueLoader) { try { return valueLoader.call(); } catch (Exception ex) { throw new ValueRetrievalException(key, valueLoader, ex); } }
@Override @Nullable public V call() throws Exception { try { return this.delegate.call(); } catch (Throwable ex) { this.errorHandler.handleError(ex); return null; } } }
/** * 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); }
/** 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; }
@Override public V call() throws Exception { try (ACLContext ctxt = ACL.as(authentication)) { return r.call(); } } };