io.vertx.core.shareddata.Counter Java Examples

The following examples show how to use io.vertx.core.shareddata.Counter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StepExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Consumer<Throwable> errorHandler,
        ThrowableErrorConsumer<Throwable, T> onFailureRespond,
        Consumer<Throwable> errorMethodHandler,
        Consumer<ExecutionResult<T>> resultConsumer,
        AsyncResult<T> event,
        Lock lock,
        Counter counter) {
    counter.addAndGet(
            LOCK_VALUE,
            val -> {
                lock.release();
                errorHandling(
                        errorHandler,
                        onFailureRespond,
                        errorMethodHandler,
                        resultConsumer,
                        Future.failedFuture(event.cause()));
            });
}
 
Example #2
Source File: StepExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Promise<ExecutionResult<T>> _resultHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, T> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable e,
    Lock lck,
    Counter counter) {
  counter.addAndGet(
      LOCK_VALUE,
      val -> {
        lck.release();
        final Vertx vertx = vxmsShared.getVertx();
        vertx.executeBlocking(
            bhandler -> {
              T result = handleError(_errorHandler, _onFailureRespond, _errorMethodHandler, e);
              if (!_resultHandler.future().isComplete()) {
                _resultHandler.complete(new ExecutionResult<>(result, true, true, null));
              }
            },
            false,
            res -> {});
      });
}
 
Example #3
Source File: ResponseExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
    Consumer<Throwable> errorHandler,
    ThrowableErrorConsumer<Throwable, T> onFailureRespond,
    Consumer<Throwable> errorMethodHandler,
    Consumer<ExecutionResult<T>> resultConsumer,
    AsyncResult<T> event,
    Lock lock,
    Counter counter) {
  counter.addAndGet(
      LOCK_VALUE,
      val -> {
        lock.release();
        errorHandling(
            errorHandler,
            onFailureRespond,
            errorMethodHandler,
            resultConsumer,
            Future.failedFuture(event.cause()));
      });
}
 
Example #4
Source File: StepExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Consumer<Throwable> errorHandler,
        ThrowableErrorConsumer<Throwable, T> onFailureRespond,
        Consumer<Throwable> errorMethodHandler,
        Consumer<ExecutionResult<T>> resultConsumer,
        AsyncResult<T> event,
        Lock lock,
        Counter counter) {
    counter.addAndGet(
            LOCK_VALUE,
            val -> {
                lock.release();
                errorHandling(
                        errorHandler,
                        onFailureRespond,
                        errorMethodHandler,
                        resultConsumer,
                        Future.failedFuture(event.cause()));
            });
}
 
Example #5
Source File: ResponseExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
    Consumer<Throwable> errorHandler,
    ThrowableErrorConsumer<Throwable, T> onFailureRespond,
    Consumer<Throwable> errorMethodHandler,
    Consumer<ExecutionResult<T>> resultConsumer,
    AsyncResult<T> event,
    Lock lock,
    Counter counter) {
  counter.addAndGet(
      LOCK_VALUE,
      val -> {
        lock.release();
        errorHandling(
            errorHandler,
            onFailureRespond,
            errorMethodHandler,
            resultConsumer,
            Future.failedFuture(event.cause()));
      });
}
 
Example #6
Source File: StepExecution.java    From vxms with Apache License 2.0 6 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Promise<ExecutionResult<T>> _blockingHandler,
        Consumer<Throwable> _errorHandler,
        ThrowableFunction<Throwable, T> _onFailureRespond,
        Consumer<Throwable> _errorMethodHandler,
        VxmsShared vxmsShared,
        Throwable e,
        Lock lck,
        Counter counter) {
    counter.addAndGet(
            LOCK_VALUE,
            val -> {
                lck.release();
                final Vertx vertx = vxmsShared.getVertx();
                vertx.executeBlocking(
                        bhandler -> {
                            T result = handleError(_errorHandler, _onFailureRespond, _errorMethodHandler, e);
                            if (!_blockingHandler.future().isComplete()) {
                                _blockingHandler.complete(new ExecutionResult<>(result, true, true, null));
                            }
                        },
                        false,
                        res -> {
                        });
            });
}
 
Example #7
Source File: AtomicCounterTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
@Test
public void testAtomicSyncCounter3() {
  long max = 3;
  vertx
      .sharedData()
      .getCounter(
          "counter1",
          resultHandler -> {
            final Counter counter = resultHandler.result();
            counter.get(
                handler -> {
                  long val = handler.result();
                  if (val == 0) {
                    counter.addAndGet(
                        max,
                        hhh -> {
                          System.out.println("::::" + hhh.result());
                        });
                  } else {

                  }
                });
          });
}
 
Example #8
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T, V> void handleStatefulError(
        String _methodId,
        int _retry,
        long _timeout,
        long _circuitBreakerTimeout,
        ThrowableFutureBiConsumer<T, V> step,
        T inputValue,
        Consumer<Throwable> errorHandler,
        ThrowableErrorConsumer<Throwable, V> onFailureRespond,
        Consumer<Throwable> errorMethodHandler,
        VxmsShared vxmsShared,
        Consumer<ExecutionResult<V>> resultConsumer,
        AsyncResult<V> event,
        Lock lock,
        Counter counter,
        AsyncResult<Long> valHandler) {
    long count = valHandler.result();
    if (count <= DEFAULT_LONG_VALUE) {
        setCircuitBreakerReleaseTimer(_retry, _circuitBreakerTimeout, vxmsShared, counter);
        openCircuitBreakerAndHandleError(
                errorHandler, onFailureRespond, errorMethodHandler, resultConsumer, event, lock, counter);
    } else {
        lock.release();
        retry(
                _methodId,
                _retry,
                _timeout,
                _circuitBreakerTimeout,
                step,
                inputValue,
                errorHandler,
                onFailureRespond,
                errorMethodHandler,
                vxmsShared,
                resultConsumer,
                event);
    }
}
 
Example #9
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void setCircuitBreakerReleaseTimer(
        int _retry, long _release, VxmsShared vxmsShared, Counter counter) {
    final long initialRetryCounterValue = (long) (_retry + 1);
    final Vertx vertx = vxmsShared.getVertx();
    vertx.setTimer(_release, timer -> counter.addAndGet(initialRetryCounterValue, val -> {
    }));
}
 
Example #10
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void handleStatefulError(
    String _methodId,
    int _retry,
    long _timeout,
    long _circuitBreakerTimeout,
    ThrowableFutureConsumer<T> _userOperation,
    Consumer<Throwable> errorHandler,
    ThrowableErrorConsumer<Throwable, T> onFailureRespond,
    Consumer<Throwable> errorMethodHandler,
    VxmsShared vxmsShared,
    Consumer<ExecutionResult<T>> resultConsumer,
    AsyncResult<T> event,
    Lock lock,
    Counter counter,
    AsyncResult<Long> valHandler) {
  long count = valHandler.result();
  if (count <= DEFAULT_LONG_VALUE) {
    setCircuitBreakerReleaseTimer(_retry, _circuitBreakerTimeout, vxmsShared, counter);
    openCircuitBreakerAndHandleError(
        errorHandler, onFailureRespond, errorMethodHandler, resultConsumer, event, lock, counter);
  } else {
    lock.release();
    retry(
        _methodId,
        _retry,
        _timeout,
        _circuitBreakerTimeout,
        _userOperation,
        errorHandler,
        onFailureRespond,
        errorMethodHandler,
        vxmsShared,
        resultConsumer,
        event);
  }
}
 
Example #11
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void executeInitialState(
    int _retry,
    long _timeout,
    ThrowableFutureConsumer<T> _userOperation,
    VxmsShared vxmsShared,
    Promise<T> operationResult,
    Lock lock,
    Counter counter) {
  final long initialRetryCounterValue = (long) (_retry + 1);
  counter.addAndGet(
      initialRetryCounterValue,
      rHandler ->
          executeDefaultState(_timeout, _userOperation, vxmsShared, operationResult, lock));
}
 
Example #12
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void setCircuitBreakerReleaseTimer(
    VxmsShared vxmsShared, int _retry, long _circuitBreakerTimeout, Counter counter) {
  final long initialRetryCounterValue = (long) (_retry + 1);
  final Vertx vertx = vxmsShared.getVertx();
  vertx.setTimer(
      _circuitBreakerTimeout, timer -> counter.addAndGet(initialRetryCounterValue, val -> {
      }));
}
 
Example #13
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Promise<ExecutionResult<T>> _blockingHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, T> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable e,
    Lock lck,
    Counter counter) {
  counter.addAndGet(
      LOCK_VALUE,
      val -> {
        lck.release();
        final Vertx vertx = vxmsShared.getVertx();
        vertx.executeBlocking(
            bhandler -> {
              T result = handleError(_errorHandler, _onFailureRespond, _errorMethodHandler,
                  _blockingHandler, e);
              if (!_blockingHandler.future().isComplete()) {
                _blockingHandler.complete(new ExecutionResult<>(result, true, true, null));
              }
            },
            false,
            res -> {
            });
      });
}
 
Example #14
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T, V> void executeInitialState(
    String _methodId,
    ThrowableFunction<T, V> step,
    T value,
    Promise<ExecutionResult<V>> _resultHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, V> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable _t,
    int _retry,
    long _timeout,
    long _circuitBreakerTimeout,
    long _delay,
    Lock lock,
    Counter counter) {
  final long initialRetryCounterValue = (long) (_retry + 1);
  counter.addAndGet(
      initialRetryCounterValue,
      rHandler ->
          executeDefault(
              _methodId,
              step,
              value,
              _resultHandler,
              _errorHandler,
              _onFailureRespond,
              _errorMethodHandler,
              vxmsShared,
              _t,
              _retry,
              _timeout,
              _circuitBreakerTimeout,
              _delay,
              lock));
}
 
Example #15
Source File: InfinispanClusterManager.java    From vertx-infinispan with Apache License 2.0 5 votes vote down vote up
@Override
public void getCounter(String name, Promise<Counter> promise) {
  vertx.executeBlocking(prom -> {
    if (!counterManager.isDefined(name)) {
      counterManager.defineCounter(name, CounterConfiguration.builder(CounterType.UNBOUNDED_STRONG).build());
    }
    prom.complete(new InfinispanCounter(vertx, counterManager.getStrongCounter(name).sync()));
  }, false, promise);
}
 
Example #16
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void executeInitialState(
    String _methodId,
    ThrowableSupplier<T> _supplier,
    Promise<ExecutionResult<T>> _blockingHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, T> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable _t,
    int _retry,
    long _timeout,
    long _circuitBreakerTimeout,
    long _delay,
    Lock lock,
    Counter counter) {
  final long initialRetryCounterValue = (long) (_retry + 1);
  counter.addAndGet(
      initialRetryCounterValue,
      rHandler ->
          executeDefault(
              _methodId,
              _supplier,
              _blockingHandler,
              _errorHandler,
              _onFailureRespond,
              _errorMethodHandler,
              vxmsShared,
              _t,
              _retry,
              _timeout,
              _circuitBreakerTimeout,
              _delay,
              lock));
}
 
Example #17
Source File: EventbusBridgeExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void openCircuitAndHandleError(
    String methodId,
    VxmsShared vxmsShared,
    Consumer<Throwable> errorMethodHandler,
    Message<Object> requestMessage,
    Encoder encoder,
    Consumer<Throwable> errorHandler,
    ThrowableErrorConsumer<Throwable, T> onFailureRespond,
    DeliveryOptions responseDeliveryOptions,
    int retryCount,
    long timeout,
    long circuitBreakerTimeout,
    RecursiveExecutor<T> executor,
    AsyncResult<Message<Object>> event,
    Lock lock,
    Counter counter) {
  resetLockTimer(vxmsShared, retryCount, circuitBreakerTimeout, counter);
  lockAndHandle(
      counter,
      val -> {
        final Throwable cause = event.cause();
        handleError(
            methodId,
            vxmsShared,
            errorMethodHandler,
            requestMessage,
            encoder,
            errorHandler,
            onFailureRespond,
            responseDeliveryOptions,
            retryCount,
            timeout,
            circuitBreakerTimeout,
            executor,
            lock,
            cause);
      });
}
 
Example #18
Source File: EventbusBridgeExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void resetLockTimer(
    VxmsShared vxmsShared, int retryCount, long circuitBreakerTimeout, Counter counter) {
  final Vertx vertx = vxmsShared.getVertx();
  vertx.setTimer(
      circuitBreakerTimeout,
      timer -> counter.addAndGet(Integer.valueOf(retryCount + 1).longValue(), val -> {}));
}
 
Example #19
Source File: EventbusBridgeExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void openCircuitAndHandleError(
    String methodId,
    VxmsShared vxmsShared,
    Consumer<Throwable> errorMethodHandler,
    Message<Object> requestMessage,
    Encoder encoder,
    Consumer<Throwable> errorHandler,
    ThrowableFunction<Throwable, T> onFailureRespond,
    DeliveryOptions responseDeliveryOptions,
    int retryCount,
    long timeout,
    long delay,
    long circuitBreakerTimeout,
    RecursiveExecutor<T> executor,
    AsyncResult<Message<Object>> event,
    Lock lock,
    Counter counter) {
  resetLockTimer(vxmsShared, retryCount, circuitBreakerTimeout, counter);
  lockAndHandle(
      counter,
      val -> {
        final Throwable cause = event.cause();
        handleError(
            methodId,
            vxmsShared,
            errorMethodHandler,
            requestMessage,
            encoder,
            errorHandler,
            onFailureRespond,
            responseDeliveryOptions,
            retryCount,
            timeout,
            delay,
            circuitBreakerTimeout,
            executor,
            lock,
            cause);
      });
}
 
Example #20
Source File: EventbusBridgeExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void resetLockTimer(
    VxmsShared vxmsShared, int retryCount, long circuitBreakerTimeout, Counter counter) {
  final Vertx vertx = vxmsShared.getVertx();
  vertx.setTimer(
      circuitBreakerTimeout,
      timer -> counter.addAndGet(Integer.valueOf(retryCount + 1).longValue(), val -> {}));
}
 
Example #21
Source File: LocalData.java    From vxms with Apache License 2.0 5 votes vote down vote up
/**
 * Get a local counter. The counter will be passed to the handler.
 *
 * @param name the name of the counter.
 * @param resultHandler the handler
 */
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler) {
  Objects.requireNonNull(name, "name");
  Objects.requireNonNull(resultHandler, "resultHandler");
  Counter counter = this.localCounters
      .computeIfAbsent(name, (n) -> new AsynchronousCounter((VertxInternal) this.vertx));
  Context context = this.vertx.getOrCreateContext();
  context.runOnContext((v) -> resultHandler.handle(Future.succeededFuture(counter)));
}
 
Example #22
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void executeInitialState(
    int retry,
    long timeout,
    ThrowableFutureConsumer<T> _userOperation,
    VxmsShared vxmsShared,
    Promise<T> operationResult,
    Lock lock,
    Counter counter) {
  final long initialRetryCounterValue = (long) (retry + 1);
  counter.addAndGet(
      initialRetryCounterValue,
      rHandler ->
          executeDefaultState(timeout, _userOperation, vxmsShared, operationResult, lock));
}
 
Example #23
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void handleStatefulError(
    String methodId,
    int retry,
    long timeout,
    long circuitBreakerTimeout,
    ThrowableFutureConsumer<T> _userOperation,
    Consumer<Throwable> errorHandler,
    ThrowableErrorConsumer<Throwable, T> onFailureRespond,
    Consumer<Throwable> errorMethodHandler,
    VxmsShared vxmsShared,
    Consumer<ExecutionResult<T>> resultConsumer,
    AsyncResult<T> event,
    Lock lock,
    Counter counter,
    AsyncResult<Long> valHandler) {
  long count = valHandler.result();
  if (count <= DEFAULT_LONG_VALUE) {
    setCircuitBreakerReleaseTimer(retry, circuitBreakerTimeout, vxmsShared.getVertx(), counter);
    openCircuitBreakerAndHandleError(
        errorHandler, onFailureRespond, errorMethodHandler, resultConsumer, event, lock, counter);
  } else {
    lock.release();
    retry(
        methodId,
        retry,
        timeout,
        circuitBreakerTimeout,
        _userOperation,
        errorHandler,
        onFailureRespond,
        errorMethodHandler,
        vxmsShared,
        resultConsumer,
        event);
  }
}
 
Example #24
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T, V> void executeInitialState(
        int retry,
        long timeout,
        ThrowableFutureBiConsumer<T, V> _step,
        T _inputValue,
        VxmsShared vxmsShared,
        Promise<V> operationResult,
        Lock lock,
        Counter counter) {
    final long initialRetryCounterValue = (long) (retry + 1);
    counter.addAndGet(
            initialRetryCounterValue,
            rHandler ->
                    executeDefaultState(timeout, _step, _inputValue, vxmsShared, operationResult, lock));
}
 
Example #25
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T, V> void handleStatefulError(
        String methodId,
        int retry,
        long timeout,
        long circuitBreakerTimeout,
        ThrowableFutureBiConsumer<T, V> _step,
        T _inputValue,
        Consumer<Throwable> errorHandler,
        ThrowableErrorConsumer<Throwable, V> onFailureRespond,
        Consumer<Throwable> errorMethodHandler,
        VxmsShared vxmsShared,
        Consumer<ExecutionResult<V>> resultConsumer,
        AsyncResult<V> event,
        Lock lock,
        Counter counter,
        AsyncResult<Long> valHandler) {
    long count = valHandler.result();
    if (count <= DEFAULT_LONG_VALUE) {
        setCircuitBreakerReleaseTimer(retry, circuitBreakerTimeout, vxmsShared.getVertx(), counter);
        openCircuitBreakerAndHandleError(
                errorHandler, onFailureRespond, errorMethodHandler, resultConsumer, event, lock, counter);
    } else {
        lock.release();
        retry(
                methodId,
                retry,
                timeout,
                circuitBreakerTimeout,
                _step,
                _inputValue,
                errorHandler,
                onFailureRespond,
                errorMethodHandler,
                vxmsShared,
                resultConsumer,
                event);
    }
}
 
Example #26
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void executeInitialState(
    String _methodId,
    ThrowableSupplier<T> _supplier,
    Promise<ExecutionResult<T>> _blockingHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, T> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable _t,
    int _retry,
    long _timeout,
    long _circuitBreakerTimeout,
    long _delay,
    Lock lock,
    Counter counter) {
  final long initialRetryCounterValue = (long) (_retry + 1);
  counter.addAndGet(
      initialRetryCounterValue,
      rHandler ->
          executeDefault(
              _methodId,
              _supplier,
              _blockingHandler,
              _errorHandler,
              _onFailureRespond,
              _errorMethodHandler,
              vxmsShared,
              _t,
              _retry,
              _timeout,
              _circuitBreakerTimeout,
              _delay,
              lock));
}
 
Example #27
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T> void openCircuitBreakerAndHandleError(
        Promise<ExecutionResult<T>> _blockingHandler,
    Consumer<Throwable> _errorHandler,
    ThrowableFunction<Throwable, T> _onFailureRespond,
    Consumer<Throwable> _errorMethodHandler,
    VxmsShared vxmsShared,
    Throwable e,
    Lock lck,
    Counter counter) {
  counter.addAndGet(
      LOCK_VALUE,
      val -> {
        lck.release();
        final Vertx vertx = vxmsShared.getVertx();
        vertx.executeBlocking(
            bhandler -> {
              T result =
                  handleError(
                      _errorHandler, _onFailureRespond, _errorMethodHandler, _blockingHandler, e);
              if (!_blockingHandler.future().isComplete()) {
                _blockingHandler.complete(new ExecutionResult<>(result, true, true, null));
              }
            },
            false,
            res -> {});
      });
}
 
Example #28
Source File: ResponseExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void setCircuitBreakerReleaseTimer(
    VxmsShared vxmsShared, int _retry, long _circuitBreakerTimeout, Counter counter) {
  final Vertx vertx = vxmsShared.getVertx();
  vertx.setTimer(
      _circuitBreakerTimeout,
      timer -> {
        final long initialRetryCounterValue = (long) (_retry + 1);
        counter.addAndGet(initialRetryCounterValue, val -> {});
      });
}
 
Example #29
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static <T, V> void executeInitialState(
        String _methodId,
        ThrowableFunction<T, V> step,
        T value,
        Promise<ExecutionResult<V>> _blockingHandler,
        Consumer<Throwable> _errorHandler,
        ThrowableFunction<Throwable, V> _onFailureRespond,
        Consumer<Throwable> _errorMethodHandler,
        VxmsShared vxmsShared,
        Throwable _t,
        int _retry,
        long _timeout,
        long _circuitBreakerTimeout,
        long _delay,
        Lock lock,
        Counter counter) {
    final long initialRetryCounterValue = (long) (_retry + 1);
    counter.addAndGet(
            initialRetryCounterValue,
            rHandler ->
                    executeDefault(
                            _methodId,
                            step,
                            value,
                            _blockingHandler,
                            _errorHandler,
                            _onFailureRespond,
                            _errorMethodHandler,
                            vxmsShared,
                            _t,
                            _retry,
                            _timeout,
                            _circuitBreakerTimeout,
                            _delay,
                            lock));
}
 
Example #30
Source File: StepExecution.java    From vxms with Apache License 2.0 5 votes vote down vote up
private static void setCircuitBreakerReleaseTimer(
        VxmsShared vxmsShared, int _retry, long _circuitBreakerTimeout, Counter counter) {
    final Vertx vertx = vxmsShared.getVertx();
    vertx.setTimer(
            _circuitBreakerTimeout,
            timer -> {
                final long initialRetryCounterValue = (long) (_retry + 1);
                counter.addAndGet(initialRetryCounterValue, val -> {
                });
            });
}