AtomicInteger uses compare-and-swap (CAS) processor instruction to update the counter. It works great, until under high contention it doesn’t run into a spin lock, as the operation is retried in infinite loop, until it succeeds. Java8 LongAdder does not try to compete for accessing the value to increment, but instead – saves the value in […]
Read moreTag Archives: java8
Java invokedynamic
Invokedynamic is a JVM bytecode instruction for invoking methods, which facilitates runtime type checking. Before invokedynamic was introduced in Java 1.7, we had 4 opcodes for calling methods: invokevirtual – used for public and protected instance methods invokestatic – used for static methods invokeinterface – used for methods call through an interface invokespecial – used […]
Read more