RandomBackoff.java
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.crashlytics.android.answers;
import io.fabric.sdk.android.services.concurrency.internal.Backoff;
import java.util.Random;
class RandomBackoff
implements Backoff
{
final Backoff backoff;
final double jitterPercent;
final Random random;
public RandomBackoff(Backoff paramBackoff, double paramDouble)
{
this(paramBackoff, paramDouble, new Random());
}
public RandomBackoff(Backoff paramBackoff, double paramDouble, Random paramRandom)
{
if ((paramDouble < 0.0D) || (paramDouble > 1.0D)) {
throw new IllegalArgumentException("jitterPercent must be between 0.0 and 1.0");
}
if (paramBackoff == null) {
throw new NullPointerException("backoff must not be null");
}
if (paramRandom == null) {
throw new NullPointerException("random must not be null");
}
this.backoff = paramBackoff;
this.jitterPercent = paramDouble;
this.random = paramRandom;
}
public long getDelayMillis(int paramInt)
{
return (randomJitter() * this.backoff.getDelayMillis(paramInt));
}
double randomJitter()
{
double d = 1.0D - this.jitterPercent;
return d + (this.jitterPercent + 1.0D - d) * this.random.nextDouble();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/crashlytics/android/answers/RandomBackoff.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/