forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retry fetching event from remote cache
Closes keycloak#28303 Signed-off-by: Pedro Ruivo <[email protected]> Signed-off-by: Alexander Schwartz <[email protected]> Co-authored-by: Alexander Schwartz <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
package org.keycloak.common.util; | ||
|
||
import java.time.Duration; | ||
import java.util.Random; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Stian Thorgersen</a> | ||
|
@@ -125,8 +125,8 @@ public static int executeWithBackoff(AdvancedRunnable runnable, ThrowableCallbac | |
} | ||
} | ||
|
||
private static int computeBackoffInterval(int base, int iteration) { | ||
return new Random().nextInt(computeIterationBase(base, iteration)); | ||
public static int computeBackoffInterval(int base, int iteration) { | ||
return ThreadLocalRandom.current().nextInt(computeIterationBase(base, iteration)); | ||
} | ||
|
||
private static int computeIterationBase(int base, int iteration) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters