Java Magazine, May/June 2018
ORACLE COM JAVAMAGAZINE MAY JUNE 2018 78 inside the jvm for int i 0 i 1_ 000_ 000 i synchronized lock sum random nextInt synchronized lock sum random nextInt System out println sum The bytecode for this method is rather verbose and looks like this public optjava CoarsenedLocks descriptor V flags ACC_ PUBLIC Code stack 5 locals 5 args_ size 1 0 aload_ 0 1 invokespecial 3 Method java lang Object init V 4 aload_ 0 5 lconst_ 0 6 putfield 4 Field sum J 9 iconst_ 0 10 istore_ 1 11 iload_ 1 12 ldc 5 int 1000000 14 if_ icmpge 73 17 aload_ 0
You must have JavaScript enabled to view digital editions.