Skip to content

Commit

Permalink
PAYARA-3468 extract ChronoUnit from Config as ChronoUnit.class
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee committed Mar 28, 2019
1 parent 143e9f6 commit 40cbc2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,21 @@ private Object retry(InvocationContext invocationContext) throws Exception {
.orElse(retry.delay());
// Look for a String and cast to ChronoUnit - Use the Common Sense Convertor
ChronoUnit delayUnit = FaultToleranceCdiUtils.getOverrideValue(
config, Retry.class, "delayUnit", invocationContext, String.class).map(ChronoUnit::valueOf)
config, Retry.class, "delayUnit", invocationContext, ChronoUnit.class)
.orElse(retry.delayUnit());
long maxDuration = FaultToleranceCdiUtils.getOverrideValue(
config, Retry.class, "maxDuration", invocationContext, Long.class)
.orElse(retry.maxDuration());
// Look for a String and cast to ChronoUnit - Use the Common Sense Convertor
ChronoUnit durationUnit = FaultToleranceCdiUtils.getOverrideValue(
config, Retry.class, "durationUnit", invocationContext, String.class).map(ChronoUnit::valueOf)
config, Retry.class, "durationUnit", invocationContext, ChronoUnit.class)
.orElse(retry.durationUnit());
long jitter = FaultToleranceCdiUtils.getOverrideValue(
config, Retry.class, "jitter", invocationContext, Long.class)
.orElse(retry.jitter());
// Look for a String and cast to ChronoUnit - Use the Common Sense Convertor
ChronoUnit jitterDelayUnit = FaultToleranceCdiUtils.getOverrideValue(
config, Retry.class, "jitterDelayUnit", invocationContext, String.class).map(ChronoUnit::valueOf)
config, Retry.class, "jitterDelayUnit", invocationContext, ChronoUnit.class)
.orElse(retry.jitterDelayUnit());

long delayMillis = Duration.of(delay, delayUnit).toMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private Object timeout(InvocationContext invocationContext) throws Exception {
.orElse(timeout.value());
// Look for a String and cast to ChronoUnit - Use the Common Sense Convertor
ChronoUnit unit = FaultToleranceCdiUtils.getOverrideValue(
config, Timeout.class, "unit", invocationContext, String.class).map(ChronoUnit::valueOf)
config, Timeout.class, "unit", invocationContext, ChronoUnit.class)
.orElse(timeout.unit());

Future<?> timeoutFuture = null;
Expand Down

0 comments on commit 40cbc2e

Please sign in to comment.