public abstract class oadd.com.google.common.util.concurrent.RateLimiter extends java.lang.Object
{
private final oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch;
private volatile java.lang.Object mutexDoNotUseDirectly;
public static oadd.com.google.common.util.concurrent.RateLimiter create(double)
{
oadd.com.google.common.util.concurrent.RateLimiter v;
double v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
v := @parameter: double;
v = staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch createFromSystemTimer()>();
v = staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter create(double,oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch)>(v, v);
return v;
}
static oadd.com.google.common.util.concurrent.RateLimiter create(double, oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch)
{
oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty v;
double v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
v := @parameter: double;
v := @parameter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch;
v = new oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty;
specialinvoke v.<oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty: void <init>(oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch,double)>(v, 1.0);
virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: void setRate(double)>(v);
return v;
}
public static oadd.com.google.common.util.concurrent.RateLimiter create(double, java.time.Duration)
{
java.util.concurrent.TimeUnit v;
java.time.Duration v;
long v;
oadd.com.google.common.util.concurrent.RateLimiter v;
double v;
v := @parameter: double;
v := @parameter: java.time.Duration;
v = staticinvoke <oadd.com.google.common.util.concurrent.Internal: long toNanosSaturated(java.time.Duration)>(v);
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit NANOSECONDS>;
v = staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter create(double,long,java.util.concurrent.TimeUnit)>(v, v, v);
return v;
}
public static oadd.com.google.common.util.concurrent.RateLimiter create(double, long, java.util.concurrent.TimeUnit)
{
java.util.concurrent.TimeUnit v;
byte v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
long v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
double v;
v := @parameter: double;
v := @parameter: long;
v := @parameter: java.util.concurrent.TimeUnit;
v = v cmp 0L;
if v < 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <oadd.com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.String,long)>(v, "warmupPeriod must not be negative: %s", v);
v = staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch createFromSystemTimer()>();
v = staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter create(double,long,java.util.concurrent.TimeUnit,double,oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch)>(v, v, v, 3.0, v);
return v;
}
static oadd.com.google.common.util.concurrent.RateLimiter create(double, long, java.util.concurrent.TimeUnit, double, oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch)
{
java.util.concurrent.TimeUnit v;
oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothWarmingUp v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
long v;
double v, v;
v := @parameter: double;
v := @parameter: long;
v := @parameter: java.util.concurrent.TimeUnit;
v := @parameter: double;
v := @parameter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch;
v = new oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothWarmingUp;
specialinvoke v.<oadd.com.google.common.util.concurrent.SmoothRateLimiter$SmoothWarmingUp: void <init>(oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch,long,java.util.concurrent.TimeUnit,double)>(v, v, v, v);
virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: void setRate(double)>(v);
return v;
}
private java.lang.Object mutex()
{
java.lang.Throwable v;
java.lang.Object v, v;
oadd.com.google.common.util.concurrent.RateLimiter v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutexDoNotUseDirectly>;
if v != null goto label;
entermonitor v;
label:
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutexDoNotUseDirectly>;
if v != null goto label;
v = new java.lang.Object;
specialinvoke v.<java.lang.Object: void <init>()>();
v = v;
v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutexDoNotUseDirectly> = v;
label:
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
return v;
catch java.lang.Throwable from label to label with label;
}
void <init>(oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch)
{
java.lang.Object v;
oadd.com.google.common.util.concurrent.RateLimiter v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch;
specialinvoke v.<java.lang.Object: void <init>()>();
v = staticinvoke <oadd.com.google.common.base.Preconditions: java.lang.Object checkNotNull(java.lang.Object)>(v);
v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch> = v;
return;
}
public final void setRate(double)
{
java.lang.Throwable v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
long v;
byte v;
java.lang.Object v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v, v;
double v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: double;
v = v cmpl 0.0;
if v <= 0 goto label;
v = staticinvoke <java.lang.Double: boolean isNaN(double)>(v);
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <oadd.com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "rate must be positive");
v = specialinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutex()>();
entermonitor v;
label:
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: long readMicros()>();
virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: void doSetRate(double,long)>(v, v);
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
}
abstract void doSetRate(double, long);
public final double getRate()
{
java.lang.Throwable v;
java.lang.Object v;
oadd.com.google.common.util.concurrent.RateLimiter v;
double v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v = specialinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutex()>();
entermonitor v;
label:
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: double doGetRate()>();
exitmonitor v;
label:
return v;
label:
v := @caughtexception;
exitmonitor v;
throw v;
catch java.lang.Throwable from label to label with label;
}
abstract double doGetRate();
public double acquire()
{
oadd.com.google.common.util.concurrent.RateLimiter v;
double v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: double acquire(int)>(1);
return v;
}
public double acquire(int)
{
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
long v, v;
java.util.concurrent.TimeUnit v;
int v;
oadd.com.google.common.util.concurrent.RateLimiter v;
double v, v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: long reserve(int)>(v);
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch>;
virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: void sleepMicrosUninterruptibly(long)>(v);
v = 1.0 * v;
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit SECONDS>;
v = virtualinvoke v.<java.util.concurrent.TimeUnit: long toMicros(long)>(1L);
v = v / v;
return v;
}
final long reserve(int)
{
java.lang.Throwable v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v;
int v;
java.lang.Object v;
long v, v;
oadd.com.google.common.util.concurrent.RateLimiter v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter: void checkPermits(int)>(v);
v = specialinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutex()>();
entermonitor v;
label:
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: long readMicros()>();
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: long reserveAndGetWaitLength(int,long)>(v, v);
exitmonitor v;
label:
return v;
label:
v := @caughtexception;
exitmonitor v;
throw v;
catch java.lang.Throwable from label to label with label;
}
public boolean tryAcquire(java.time.Duration)
{
java.util.concurrent.TimeUnit v;
java.time.Duration v;
long v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: java.time.Duration;
v = staticinvoke <oadd.com.google.common.util.concurrent.Internal: long toNanosSaturated(java.time.Duration)>(v);
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit NANOSECONDS>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean tryAcquire(int,long,java.util.concurrent.TimeUnit)>(1, v, v);
return v;
}
public boolean tryAcquire(long, java.util.concurrent.TimeUnit)
{
java.util.concurrent.TimeUnit v;
long v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: long;
v := @parameter: java.util.concurrent.TimeUnit;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean tryAcquire(int,long,java.util.concurrent.TimeUnit)>(1, v, v);
return v;
}
public boolean tryAcquire(int)
{
java.util.concurrent.TimeUnit v;
int v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit MICROSECONDS>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean tryAcquire(int,long,java.util.concurrent.TimeUnit)>(v, 0L, v);
return v;
}
public boolean tryAcquire()
{
java.util.concurrent.TimeUnit v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit MICROSECONDS>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean tryAcquire(int,long,java.util.concurrent.TimeUnit)>(1, 0L, v);
return v;
}
public boolean tryAcquire(int, java.time.Duration)
{
java.util.concurrent.TimeUnit v;
java.time.Duration v;
int v;
long v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
v := @parameter: java.time.Duration;
v = staticinvoke <oadd.com.google.common.util.concurrent.Internal: long toNanosSaturated(java.time.Duration)>(v);
v = <java.util.concurrent.TimeUnit: java.util.concurrent.TimeUnit NANOSECONDS>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean tryAcquire(int,long,java.util.concurrent.TimeUnit)>(v, v, v);
return v;
}
public boolean tryAcquire(int, long, java.util.concurrent.TimeUnit)
{
java.lang.Throwable v;
oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch v, v;
long v, v, v, v, v;
java.util.concurrent.TimeUnit v;
int v;
java.lang.Object v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
v := @parameter: long;
v := @parameter: java.util.concurrent.TimeUnit;
v = virtualinvoke v.<java.util.concurrent.TimeUnit: long toMicros(long)>(v);
v = staticinvoke <java.lang.Math: long max(long,long)>(v, 0L);
staticinvoke <oadd.com.google.common.util.concurrent.RateLimiter: void checkPermits(int)>(v);
v = specialinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: java.lang.Object mutex()>();
entermonitor v;
label:
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch>;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: long readMicros()>();
v = specialinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: boolean canAcquire(long,long)>(v, v);
if v != 0 goto label;
exitmonitor v;
label:
return 0;
label:
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: long reserveAndGetWaitLength(int,long)>(v, v);
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
v = v.<oadd.com.google.common.util.concurrent.RateLimiter: oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch stopwatch>;
virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter$SleepingStopwatch: void sleepMicrosUninterruptibly(long)>(v);
return 1;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
}
private boolean canAcquire(long, long)
{
byte v;
long v, v, v, v;
oadd.com.google.common.util.concurrent.RateLimiter v;
boolean v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: long;
v := @parameter: long;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: long queryEarliestAvailable(long)>(v);
v = v - v;
v = v cmp v;
if v > 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
return v;
}
final long reserveAndGetWaitLength(int, long)
{
int v;
long v, v, v, v;
oadd.com.google.common.util.concurrent.RateLimiter v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v := @parameter: int;
v := @parameter: long;
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: long reserveEarliestAvailable(int,long)>(v, v);
v = v - v;
v = staticinvoke <java.lang.Math: long max(long,long)>(v, 0L);
return v;
}
abstract long queryEarliestAvailable(long);
abstract long reserveEarliestAvailable(int, long);
public java.lang.String toString()
{
java.lang.Object[] v;
java.lang.Double v;
java.util.Locale v;
java.lang.String v;
oadd.com.google.common.util.concurrent.RateLimiter v;
double v;
v := @this: oadd.com.google.common.util.concurrent.RateLimiter;
v = <java.util.Locale: java.util.Locale ROOT>;
v = newarray (java.lang.Object)[1];
v = virtualinvoke v.<oadd.com.google.common.util.concurrent.RateLimiter: double getRate()>();
v = staticinvoke <java.lang.Double: java.lang.Double valueOf(double)>(v);
v[0] = v;
v = staticinvoke <java.lang.String: java.lang.String format(java.util.Locale,java.lang.String,java.lang.Object[])>(v, "RateLimiter[stableRate=%3.1fqps]", v);
return v;
}
private static void checkPermits(int)
{
int v;
boolean v;
v := @parameter: int;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <oadd.com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.String,int)>(v, "Requested permits (%s) must be positive", v);
return;
}
}