public class org.apache.cassandra.utils.SlidingTimeRate
minor version: 0
major version: 59
flags: flags: (0x0021) ACC_PUBLIC, ACC_SUPER
this_class: org.apache.cassandra.utils.SlidingTimeRate
super_class: java.lang.Object
{
private final java.util.concurrent.ConcurrentSkipListMap<java.lang.Long, java.util.concurrent.atomic.AtomicInteger> counters;
descriptor: Ljava/util/concurrent/ConcurrentSkipListMap;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
Signature: Ljava/util/concurrent/ConcurrentSkipListMap<Ljava/lang/Long;Ljava/util/concurrent/atomic/AtomicInteger;>;
private final java.util.concurrent.atomic.AtomicLong lastCounterTimestamp;
descriptor: Ljava/util/concurrent/atomic/AtomicLong;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
private final java.util.concurrent.locks.ReadWriteLock pruneLock;
descriptor: Ljava/util/concurrent/locks/ReadWriteLock;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
private final long sizeInMillis;
descriptor: J
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
private final long precisionInMillis;
descriptor: J
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
private final org.apache.cassandra.utils.TimeSource timeSource;
descriptor: Lorg/apache/cassandra/utils/TimeSource;
flags: (0x0012) ACC_PRIVATE, ACC_FINAL
public void <init>(org.apache.cassandra.utils.TimeSource, long, long, java.util.concurrent.TimeUnit);
descriptor: (Lorg/apache/cassandra/utils/TimeSource;JJLjava/util/concurrent/TimeUnit;)V
flags: (0x0001) ACC_PUBLIC
Code:
stack=5, locals=7, args_size=5
start local 0 start local 1 start local 2 start local 4 start local 6 0: aload 0
invokespecial java.lang.Object.<init>:()V
1: aload 0
new java.util.concurrent.ConcurrentSkipListMap
dup
invokespecial java.util.concurrent.ConcurrentSkipListMap.<init>:()V
putfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
2: aload 0
new java.util.concurrent.atomic.AtomicLong
dup
lconst_0
invokespecial java.util.concurrent.atomic.AtomicLong.<init>:(J)V
putfield org.apache.cassandra.utils.SlidingTimeRate.lastCounterTimestamp:Ljava/util/concurrent/atomic/AtomicLong;
3: aload 0
new java.util.concurrent.locks.ReentrantReadWriteLock
dup
invokespecial java.util.concurrent.locks.ReentrantReadWriteLock.<init>:()V
putfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
4: lload 2
lload 4
lcmp
ifle 5
iconst_1
goto 6
StackMap locals: org.apache.cassandra.utils.SlidingTimeRate org.apache.cassandra.utils.TimeSource long long java.util.concurrent.TimeUnit
StackMap stack:
5: iconst_0
StackMap locals:
StackMap stack: int
6: ldc "Size should be greater than precision."
invokestatic com.google.common.base.Preconditions.checkArgument:(ZLjava/lang/Object;)V
7: getstatic java.util.concurrent.TimeUnit.MILLISECONDS:Ljava/util/concurrent/TimeUnit;
lload 4
aload 6
invokevirtual java.util.concurrent.TimeUnit.convert:(JLjava/util/concurrent/TimeUnit;)J
lconst_1
lcmp
iflt 8
iconst_1
goto 9
StackMap locals:
StackMap stack:
8: iconst_0
StackMap locals:
StackMap stack: int
9: ldc "Precision must be greater than or equal to 1 millisecond."
invokestatic com.google.common.base.Preconditions.checkArgument:(ZLjava/lang/Object;)V
10: aload 0
getstatic java.util.concurrent.TimeUnit.MILLISECONDS:Ljava/util/concurrent/TimeUnit;
lload 2
aload 6
invokevirtual java.util.concurrent.TimeUnit.convert:(JLjava/util/concurrent/TimeUnit;)J
putfield org.apache.cassandra.utils.SlidingTimeRate.sizeInMillis:J
11: aload 0
getstatic java.util.concurrent.TimeUnit.MILLISECONDS:Ljava/util/concurrent/TimeUnit;
lload 4
aload 6
invokevirtual java.util.concurrent.TimeUnit.convert:(JLjava/util/concurrent/TimeUnit;)J
putfield org.apache.cassandra.utils.SlidingTimeRate.precisionInMillis:J
12: aload 0
aload 1
putfield org.apache.cassandra.utils.SlidingTimeRate.timeSource:Lorg/apache/cassandra/utils/TimeSource;
13: return
end local 6 end local 4 end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 14 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
0 14 1 timeSource Lorg/apache/cassandra/utils/TimeSource;
0 14 2 size J
0 14 4 precision J
0 14 6 unit Ljava/util/concurrent/TimeUnit;
MethodParameters:
Name Flags
timeSource
size
precision
unit
public void update(int);
descriptor: (I)V
flags: (0x0001) ACC_PUBLIC
Code:
stack=5, locals=10, args_size=2
start local 0 start local 1 0: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.lock:()V
1: StackMap locals:
StackMap stack:
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.timeSource:Lorg/apache/cassandra/utils/TimeSource;
invokeinterface org.apache.cassandra.utils.TimeSource.currentTimeMillis:()J
lstore 2
start local 2 2: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.lastCounterTimestamp:Ljava/util/concurrent/atomic/AtomicLong;
invokevirtual java.util.concurrent.atomic.AtomicLong.get:()J
lstore 4
start local 4 3: lload 2
lload 4
lsub
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.precisionInMillis:J
lcmp
ifge 4
iconst_1
goto 5
StackMap locals: long long
StackMap stack:
4: iconst_0
StackMap locals:
StackMap stack: int
5: istore 6
start local 6 6: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
lload 4
invokestatic java.lang.Long.valueOf:(J)Ljava/lang/Long;
invokevirtual java.util.concurrent.ConcurrentSkipListMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
checkcast java.util.concurrent.atomic.AtomicInteger
astore 7
start local 7 7: aload 7
ifnull 10
iload 6
ifeq 10
8: aload 7
iload 1
invokevirtual java.util.concurrent.atomic.AtomicInteger.addAndGet:(I)I
pop
9: goto 18
10: StackMap locals: int java.util.concurrent.atomic.AtomicInteger
StackMap stack:
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.lastCounterTimestamp:Ljava/util/concurrent/atomic/AtomicLong;
lload 4
lload 2
invokevirtual java.util.concurrent.atomic.AtomicLong.compareAndSet:(JJ)Z
ifeq 1
11: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
lload 2
invokestatic java.lang.Long.valueOf:(J)Ljava/lang/Long;
new java.util.concurrent.atomic.AtomicInteger
dup
iload 1
invokespecial java.util.concurrent.atomic.AtomicInteger.<init>:(I)V
invokevirtual java.util.concurrent.ConcurrentSkipListMap.putIfAbsent:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
checkcast java.util.concurrent.atomic.AtomicInteger
astore 8
start local 8 12: aload 8
ifnull 18
13: aload 8
iload 1
invokevirtual java.util.concurrent.atomic.AtomicInteger.addAndGet:(I)I
pop
end local 8 end local 7 end local 6 end local 4 end local 2 14: goto 18
15: StackMap locals: org.apache.cassandra.utils.SlidingTimeRate int
StackMap stack: java.lang.Throwable
astore 9
16: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
17: aload 9
athrow
18: StackMap locals:
StackMap stack:
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
19: return
end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 20 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
0 20 1 delta I
2 14 2 now J
3 14 4 lastTimestamp J
6 14 6 isWithinPrecisionRange Z
7 14 7 lastCounter Ljava/util/concurrent/atomic/AtomicInteger;
12 14 8 existing Ljava/util/concurrent/atomic/AtomicInteger;
Exception table:
from to target type
1 15 15 any
MethodParameters:
Name Flags
delta
public double get(long, java.util.concurrent.TimeUnit);
descriptor: (JLjava/util/concurrent/TimeUnit;)D
flags: (0x0001) ACC_PUBLIC
Code:
stack=8, locals=18, args_size=3
start local 0 start local 1 start local 3 0: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.lock:()V
1: getstatic java.util.concurrent.TimeUnit.MILLISECONDS:Ljava/util/concurrent/TimeUnit;
lload 1
aload 3
invokevirtual java.util.concurrent.TimeUnit.convert:(JLjava/util/concurrent/TimeUnit;)J
lstore 4
start local 4 2: lload 4
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.sizeInMillis:J
lcmp
ifge 3
iconst_1
goto 4
StackMap locals: long
StackMap stack:
3: iconst_0
StackMap locals:
StackMap stack: int
4: ldc "Cannot get rate in the past!"
invokestatic com.google.common.base.Preconditions.checkArgument:(ZLjava/lang/Object;)V
5: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.timeSource:Lorg/apache/cassandra/utils/TimeSource;
invokeinterface org.apache.cassandra.utils.TimeSource.currentTimeMillis:()J
lstore 6
start local 6 6: lconst_0
lstore 8
start local 8 7: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
8: lload 6
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.sizeInMillis:J
lsub
invokestatic java.lang.Long.valueOf:(J)Ljava/lang/Long;
iconst_1
invokevirtual java.util.concurrent.ConcurrentSkipListMap.tailMap:(Ljava/lang/Object;Z)Ljava/util/concurrent/ConcurrentNavigableMap;
9: lload 6
lload 4
lsub
invokestatic java.lang.Long.valueOf:(J)Ljava/lang/Long;
iconst_1
invokeinterface java.util.concurrent.ConcurrentNavigableMap.headMap:(Ljava/lang/Object;Z)Ljava/util/concurrent/ConcurrentNavigableMap;
10: astore 10
start local 10 11: aload 10
invokeinterface java.util.concurrent.ConcurrentNavigableMap.values:()Ljava/util/Collection;
invokeinterface java.util.Collection.iterator:()Ljava/util/Iterator;
astore 12
goto 14
StackMap locals: org.apache.cassandra.utils.SlidingTimeRate long java.util.concurrent.TimeUnit long long long java.util.concurrent.ConcurrentNavigableMap top java.util.Iterator
StackMap stack:
12: aload 12
invokeinterface java.util.Iterator.next:()Ljava/lang/Object;
checkcast java.util.concurrent.atomic.AtomicInteger
astore 11
start local 11 13: lload 8
aload 11
invokevirtual java.util.concurrent.atomic.AtomicInteger.get:()I
i2l
ladd
lstore 8
end local 11 14: StackMap locals:
StackMap stack:
aload 12
invokeinterface java.util.Iterator.hasNext:()Z
ifne 12
15: lload 8
lconst_0
lcmp
ifne 17
16: lload 8
l2d
goto 18
17: StackMap locals: org.apache.cassandra.utils.SlidingTimeRate long java.util.concurrent.TimeUnit long long long java.util.concurrent.ConcurrentNavigableMap
StackMap stack:
lload 8
l2d
ldc 1000
lload 6
lload 4
lsub
aload 10
invokeinterface java.util.concurrent.ConcurrentNavigableMap.firstKey:()Ljava/lang/Object;
checkcast java.lang.Long
invokevirtual java.lang.Long.longValue:()J
lsub
invokestatic java.lang.Math.max:(JJ)J
l2d
ddiv
18: StackMap locals:
StackMap stack: double
dstore 11
start local 11 19: getstatic java.util.concurrent.TimeUnit.MILLISECONDS:Ljava/util/concurrent/TimeUnit;
lconst_1
aload 3
invokevirtual java.util.concurrent.TimeUnit.convert:(JLjava/util/concurrent/TimeUnit;)J
l2d
dstore 13
start local 13 20: dload 11
dload 13
dmul
dstore 16
21: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
22: dload 16
dreturn
end local 13 end local 11 end local 10 end local 8 end local 6 end local 4 23: StackMap locals: org.apache.cassandra.utils.SlidingTimeRate long java.util.concurrent.TimeUnit
StackMap stack: java.lang.Throwable
astore 15
24: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.readLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
25: aload 15
athrow
end local 3 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 26 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
0 26 1 toAgo J
0 26 3 unit Ljava/util/concurrent/TimeUnit;
2 23 4 toAgoInMillis J
6 23 6 now J
7 23 8 sum J
11 23 10 tailCounters Ljava/util/concurrent/ConcurrentNavigableMap<Ljava/lang/Long;Ljava/util/concurrent/atomic/AtomicInteger;>;
13 14 11 i Ljava/util/concurrent/atomic/AtomicInteger;
19 23 11 rateInMillis D
20 23 13 multiplier D
Exception table:
from to target type
1 21 23 any
MethodParameters:
Name Flags
toAgo
unit
public double get(java.util.concurrent.TimeUnit);
descriptor: (Ljava/util/concurrent/TimeUnit;)D
flags: (0x0001) ACC_PUBLIC
Code:
stack=4, locals=2, args_size=2
start local 0 start local 1 0: aload 0
lconst_0
aload 1
invokevirtual org.apache.cassandra.utils.SlidingTimeRate.get:(JLjava/util/concurrent/TimeUnit;)D
dreturn
end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
0 1 1 unit Ljava/util/concurrent/TimeUnit;
MethodParameters:
Name Flags
unit
public void prune();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
stack=5, locals=4, args_size=1
start local 0 0: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.writeLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.lock:()V
1: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.timeSource:Lorg/apache/cassandra/utils/TimeSource;
invokeinterface org.apache.cassandra.utils.TimeSource.currentTimeMillis:()J
lstore 1
start local 1 2: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
lload 1
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.sizeInMillis:J
lsub
invokestatic java.lang.Long.valueOf:(J)Ljava/lang/Long;
iconst_0
invokevirtual java.util.concurrent.ConcurrentSkipListMap.headMap:(Ljava/lang/Object;Z)Ljava/util/concurrent/ConcurrentNavigableMap;
invokeinterface java.util.concurrent.ConcurrentNavigableMap.clear:()V
end local 1 3: goto 7
4: StackMap locals:
StackMap stack: java.lang.Throwable
astore 3
5: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.writeLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
6: aload 3
athrow
7: StackMap locals:
StackMap stack:
aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.pruneLock:Ljava/util/concurrent/locks/ReadWriteLock;
invokeinterface java.util.concurrent.locks.ReadWriteLock.writeLock:()Ljava/util/concurrent/locks/Lock;
invokeinterface java.util.concurrent.locks.Lock.unlock:()V
8: return
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 9 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
2 3 1 now J
Exception table:
from to target type
1 4 4 any
public int size();
descriptor: ()I
flags: (0x0001) ACC_PUBLIC
Code:
stack=3, locals=1, args_size=1
start local 0 0: aload 0
getfield org.apache.cassandra.utils.SlidingTimeRate.counters:Ljava/util/concurrent/ConcurrentSkipListMap;
invokevirtual java.util.concurrent.ConcurrentSkipListMap.values:()Ljava/util/Collection;
invokeinterface java.util.Collection.stream:()Ljava/util/stream/Stream;
new java.util.concurrent.atomic.AtomicInteger
dup
invokespecial java.util.concurrent.atomic.AtomicInteger.<init>:()V
invokedynamic apply()Ljava/util/function/BinaryOperator;
Bootstrap: invokestatic java.lang.invoke.LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
org/apache/cassandra/utils/SlidingTimeRate.lambda$0(Ljava/util/concurrent/atomic/AtomicInteger;Ljava/util/concurrent/atomic/AtomicInteger;)Ljava/util/concurrent/atomic/AtomicInteger; (6)
(Ljava/util/concurrent/atomic/AtomicInteger;Ljava/util/concurrent/atomic/AtomicInteger;)Ljava/util/concurrent/atomic/AtomicInteger;
invokeinterface java.util.stream.Stream.reduce:(Ljava/lang/Object;Ljava/util/function/BinaryOperator;)Ljava/lang/Object;
checkcast java.util.concurrent.atomic.AtomicInteger
1: invokevirtual java.util.concurrent.atomic.AtomicInteger.get:()I
2: ireturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 3 0 this Lorg/apache/cassandra/utils/SlidingTimeRate;
RuntimeInvisibleAnnotations:
com.google.common.annotations.VisibleForTesting()
RuntimeInvisibleTypeAnnotations:
METHOD_RETURN
com.google.common.annotations.VisibleForTesting()
private static java.util.concurrent.atomic.AtomicInteger lambda$0(java.util.concurrent.atomic.AtomicInteger, java.util.concurrent.atomic.AtomicInteger);
descriptor: (Ljava/util/concurrent/atomic/AtomicInteger;Ljava/util/concurrent/atomic/AtomicInteger;)Ljava/util/concurrent/atomic/AtomicInteger;
flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=2, locals=2, args_size=2
start local 0 start local 1 0: aload 0
aload 1
invokevirtual java.util.concurrent.atomic.AtomicInteger.get:()I
invokevirtual java.util.concurrent.atomic.AtomicInteger.addAndGet:(I)I
pop
1: aload 0
areturn
end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 2 0 v1 Ljava/util/concurrent/atomic/AtomicInteger;
0 2 1 v2 Ljava/util/concurrent/atomic/AtomicInteger;
}
SourceFile: "SlidingTimeRate.java"
InnerClasses:
public final Lookup = java.lang.invoke.MethodHandles$Lookup of java.lang.invoke.MethodHandles