core/metrics-core-service/src/main/java/org/hawkular/metrics/core/service/DataAccessImpl.java
private <T> Observable.Transformer<T, T> applyInsertRetryPolicy() {
        return tObservable -> tObservable
                .retryWhen(errors -> {
                    Observable<Integer> range = Observable.range(1, 2);
                    return errors
                            .zipWith(range, (t, i) -> {
                                if (t instanceof DriverException) {
                                    return i;
                                }
                                throw Exceptions.propagate(t);
                            })
                            .flatMap(retryCount -> {
                                long delay = (long) Math.min(Math.pow(2, retryCount) * 1000, 3000);
                                log.debug("Retrying batch insert in " + delay + " ms");
                                return Observable.timer(delay, TimeUnit.MILLISECONDS);
                            });
                });
    }
private <T> Observable.Transformer<T, T> applyInsertRetryPolicy() {
        return tObservable -> tObservable
                .retryWhen(errors -> {
                    Observable<Integer> range = Observable.range(1, 2);
                    return errors
                            .zipWith(range, (t, i) -> {
                                if (t instanceof DriverException) {
                                    return i;
                                }
                                throw Exceptions.propagate(t);
                            })
                            .flatMap(retryCount -> {
                                long delay = (long) Math.min(Math.pow(2, retryCount) * 1000, 3000);
                                log.debug("Retrying batch insert in " + delay + " ms");
                                return Observable.timer(delay, TimeUnit.MILLISECONDS);
                            });
                });
    }
private < T > Observable . Transformer < T , T > applyInsertRetryPolicy ( ) { return tObservable -> tObservable . retryWhen ( errors -> { Observable < Integer > range = Observable . range ( 1 , 2 ) ; return errors . zipWith ( range , ( t , i ) -> { if ( t instanceof DriverException ) { return i ; } throw Exceptions . propagate ( t ) ; } ) . flatMap ( retryCount -> { long delay = ( long ) Math . min ( Math . pow ( 2 , retryCount ) * 1000 , 3000 ) ; log . debug ( "Retrying batch insert in " + delay + " ms" ) ; return Observable . timer ( delay , TimeUnit . MILLISECONDS ) ; } ) ; } ) ; }
/*
Apply our current retry policy to the insert behavior
/ * Apply our current retry policy to the insert behavior