cometd-java/cometd-java-api/cometd-java-api-common/src/main/java/org/cometd/bayeux/Promise.java
/**
     * <p>Returns a Promise that, when completed,
     * invokes the given {@link BiConsumer} function.</p>
     *
     * @param fn the function to invoke when the Promise is completed
     * @param <T> the type of the result value
     * @return a Promise that invokes the BiConsumer function
     */
Returns a Promise that, when completed,
invokes the given  BiConsumer function.

@param fn the function to invoke when the Promise is completed
@param  the type of the result value
@return a Promise that invokes the BiConsumer function
Returns a Promise that when completed invokes the given BiConsumer function . @param fn the function to invoke when the Promise is completed @param the type of the result value @return a Promise that invokes the BiConsumer function
static <T> Promise<T> complete(BiConsumer<T, Throwable> fn) {
        return new Promise<T>() {
            @Override
            public void succeed(T result) {
                fn.accept(result, null);
            }
            @Override
            public void fail(Throwable failure) {
                fn.accept(null, failure);
            }
        };
    }
static < T > Promise < T > complete ( BiConsumer < T , Throwable > fn ) { return new Promise < T > ( ) { @ Override public void succeed ( T result ) { fn . accept ( result , null ) ; } @ Override public void fail ( Throwable failure ) { fn . accept ( null , failure ) ; } } ; }
<p>Returns a Promise that, when completed,
 invokes the given {@link BiConsumer} function.</p>
<p > Returns a Promise that when completed invokes the given { @link BiConsumer } function . < / p >