Github user ajs6f commented on the issue: https://github.com/apache/jena/pull/157 The most cost a `volatile` usually incurs is a few times the time to retrieve the value (and I shouldn't think that happens normally on x86 archs, see [here](http://gee.cs.oswego.edu/dl/jmm/cookbook.html)). You are balancing that that against an integer increment, a modulo operation, and an integer comparison. Some of that may get optimized, but then the cost of the `volatile` may be much lower. Even more, to do this with precision, you'd have to make `count` into a `volatile`, too, which makes the whole thing work out again the extra machinery. Otherwise, threads might be using cached values of `count`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---