cometd-java/cometd-java-api/cometd-java-api-common/src/main/java/org/cometd/bayeux/Promise.java
/**
     * @param succeed the Consumer to call in case of successful completion
     * @param fail    the Consumer to call in case of failed completion
     * @param <T>     the type of the result value
     * @return a Promise from the given consumers
     */
@param succeed the Consumer to call in case of successful completion
@param fail    the Consumer to call in case of failed completion
@param      the type of the result value
@return a Promise from the given consumers
@param succeed the Consumer to call in case of successful completion @param fail the Consumer to call in case of failed completion @param the type of the result value @return a Promise from the given consumers
static <T> Promise<T> from(Consumer<T> succeed, Consumer<Throwable> fail) {
        return new Promise<T>() {
            @Override
            public void succeed(T result) {
                succeed.accept(result);
            }
            @Override
            public void fail(Throwable failure) {
                fail.accept(failure);
            }
        };
    }
static < T > Promise < T > from ( Consumer < T > succeed , Consumer < Throwable > fail ) { return new Promise < T > ( ) { @ Override public void succeed ( T result ) { succeed . accept ( result ) ; } @ Override public void fail ( Throwable failure ) { fail . accept ( failure ) ; } } ; }
@param succeed the Consumer to call in case of successful completion
 @param fail    the Consumer to call in case of failed completion
 @param <T>     the type of the result value
 @return a Promise from the given consumers
@param succeed the Consumer to call in case of successful completion @param fail the Consumer to call in case of failed completion @param <T > the type of the result value @return a Promise from the given consumers