2 ms·
BigDecimal has nothing to do with the issue. There is no race conditional. The code is textbook example how to use (cheap) unsafe publishing with no locks/CAS
by xxs 9y ago
BigDecimal has nothing to do with the issue.
There is no race conditional. The code is textbook example how to use (cheap) unsafe publishing with no locks/CAS -- assign to local variable and 'return' the variable value (not a class member one). There is no global cache, it's per BigDecimal instance.
As for 'this bug', yes JVM concurrency bugs are serious by definition.