Java Code Examples for org.springframework.util.concurrent.FutureAdapter

Following code examples demonstrate how to use org.springframework.util.concurrent.FutureAdapterfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.util.concurrent.FutureAdapterand various code implementation of this class.

    public static <T, S> Future<T> adapt(Future<S> base, Function<S, T> adaptor) {
        return new FutureAdapter<T, S>(base) {
            @Override
            protected T adapt(S adapteeResult) throws ExecutionException {
                return adaptor.apply(adapteeResult);
            }
        };
    } 


Advertisement
Javadoc
Abstract class that adapts a Future parameterized over S into a Future parameterized over T. All met

hods are delegated to the adaptee, where #get() and #get(long, TimeUnit) call #adapt(Object) on the adaptee's result. @author Arjen Poutsma @since 4.0 @param the type of this Future @param the type of the adaptee's Future

Read More
Advertisement