qbit/core/src/main/java/io/advantageous/qbit/reactive/Reactor.java
public <T> Callback<T> wrapCallbackErrors(final String operationDescription,
                                              final Callback<T> callback,
                                              final Callback<?> errorHandler,
                                              final Logger logger) {
        return callbackBuilder().setCallback(new Callback<T>() {
            @Override
            public void accept(T t) {
                if (logger.isDebugEnabled()) {
                    logger.debug("{} returned {}", operationDescription, t);
                }
                callback.resolve(t);
            }

        /* Provide some boiler plate error handling. */
        }).setOnError(error -> {
            logger.error(String.format("ERROR calling %s", operationDescription), error);
            errorHandler.onError(error);
        }).setOnTimeout(() -> {
            logger.error("TIMEOUT calling {}", operationDescription);
            errorHandler.onTimeout();
        })
                .build();
    }
public <T> Callback<T> wrapCallbackErrors(final String operationDescription,
                                              final Callback<T> callback,
                                              final Callback<?> errorHandler,
                                              final Logger logger) {
        return callbackBuilder().setCallback(new Callback<T>() {
            @Override
            public void accept(T t) {
                if (logger.isDebugEnabled()) {
                    logger.debug("{} returned {}", operationDescription, t);
                }
                callback.resolve(t);
            }

        /* Provide some boiler plate error handling. */
        }).setOnError(error -> {
            logger.error(String.format("ERROR calling %s", operationDescription), error);
            errorHandler.onError(error);
        }).setOnTimeout(() -> {
            logger.error("TIMEOUT calling {}", operationDescription);
            errorHandler.onTimeout();
        })
                .build();
    }
public < T > Callback < T > wrapCallbackErrors ( final String operationDescription , final Callback < T > callback , final Callback < ? > errorHandler , final Logger logger ) { return callbackBuilder ( ) . setCallback ( new Callback < T > ( ) { @ Override public void accept ( T t ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "{} returned {}" , operationDescription , t ) ; } callback . resolve ( t ) ; } /* Provide some boiler plate error handling. */ } ) . setOnError ( error -> { logger . error ( String . format ( "ERROR calling %s" , operationDescription ) , error ) ; errorHandler . onError ( error ) ; } ) . setOnTimeout ( ( ) -> { logger . error ( "TIMEOUT calling {}" , operationDescription ) ; errorHandler . onTimeout ( ) ; } ) . build ( ) ; }
Used for quickly delegating one callback to another when the return types are different.
This is usually the case if you want to do some transformation of the object and not just return it.
<p>
This allows one liners so you don't have to create a builder for this common case.

@param operationDescription Describe the operation for logging
@param logger               logger to log errors and timeouts.
@param errorHandler         Callback that does the error handling if the delegated call fails.
@param callback             callback to delegate error and timeouts too.
@param <T>                  Generic type
@return wrapped callback that is tied to this reactor.
Used for quickly delegating one callback to another when the return types are different . This is usually the case if you want to do some transformation of the object and not just return it . <p > This allows one liners so you don t have to create a builder for this common case .