| 构造器和说明 |
|---|
PollerBuilder() |
| 限定符和类型 | 方法和说明 |
|---|---|
Poller<V> |
build()
Finally build the
Poller instance. |
static <V> PollerBuilder<V> |
newBuilder()
Constructs a new builder
|
PollerBuilder<V> |
polling(AttemptMaker<V> attemptMaker)
Sets the code of actual polling.
|
PollerBuilder<V> |
stopIfException(boolean stopIfException)
Set if poller should stop when an exception is thrown.
|
PollerBuilder<V> |
withExecutorService(ExecutorService executorService)
Sets the
ExecutorService on which Poller will be running. |
PollerBuilder<V> |
withStopStrategy(StopStrategy... stopStrategies)
Sets a list of stop strategies used to decide when to stop retrying. polling will stop if any stop strategy's condition is fulfilled.
|
PollerBuilder<V> |
withStopStrategy(StopStrategy stopStrategy)
Sets the stop strategy used to decide when to stop retrying.
|
PollerBuilder<V> |
withWaitStrategy(WaitStrategy... waitStrategies)
Sets a list of wait strategy used to decide how long to sleep between failed attempts.
|
PollerBuilder<V> |
withWaitStrategy(WaitStrategy waitStrategy)
Sets the wait strategy used to decide how long to sleep between failed attempts.
|
public PollerBuilder<V> withWaitStrategy(WaitStrategy waitStrategy)
waitStrategy - the strategy used to sleep between failed attemptsthisIllegalStateException - if a wait strategy has already been set.public PollerBuilder<V> withWaitStrategy(WaitStrategy... waitStrategies)
waitStrategies - list of strategies used to sleep between failed attemptsthisIllegalStateException - if a wait strategy has already been set.public PollerBuilder<V> stopIfException(boolean stopIfException)
true.stopIfException - whether poller should stop if exception occurredthispublic PollerBuilder<V> withStopStrategy(StopStrategy stopStrategy)
stopStrategy - the strategy used to decide when to stop retryingthisIllegalStateException - if a stop strategy has already been set.public PollerBuilder<V> withStopStrategy(StopStrategy... stopStrategies)
stopStrategies - list of strategies used to decide when to stop retrying.thisIllegalStateException - if a stop strategy has already been set.public PollerBuilder<V> withExecutorService(ExecutorService executorService)
ExecutorService on which Poller will be running. The default is on the thread that calls Poller.start().executorService - the executor service which is used to do the polling.thisIllegalStateException - if an executor service has already been set.public PollerBuilder<V> polling(AttemptMaker<V> attemptMaker)
attemptMaker - the polling body.thisIllegalArgumentException - if an attempt maker has already been set.public static <V> PollerBuilder<V> newBuilder()
V - result type of Poller's polling for.Copyright © 2019. All rights reserved.