Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 15th, 2017 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. static <T> Supplier<T> decorateSupplier(CircuitBreaker circuitBreaker, Supplier<T> supplier){
  2.     return () -> {
  3.         CircuitBreakerUtils.isCallPermitted(circuitBreaker);
  4.         long start = System.nanoTime();
  5.         try {
  6.             T returnValue = supplier.get();
  7.             long durationInNanos = System.nanoTime() - start;
  8.             circuitBreaker.onSuccess(durationInNanos);
  9.             return returnValue;
  10.         } catch (Throwable throwable) {
  11.             long durationInNanos = System.nanoTime() - start;
  12.             circuitBreaker.onError(durationInNanos, throwable);
  13.             throw throwable;
  14.         }
  15.     };
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top