aerospike/aerospike-client-java — pull request #2 by rosolovskiy (2014-04-30 13:42:14+00:00)
Title: fixing concurrent access bug for BatchExecutor

Hi Brian,

We discovered an issues in our system when that our business threads are hanging forever, waiting for waitTillComplete() forever. Thread and Heap dumps have shown that all BatchThread instances has complete flag True, but BatchExecutor (owner class) has it set to False.

After some tests we discovered that there is concurrent access issue in threadCompleted() method, when traversing BatchThread instances without any protection.

This fix adds volatile flag for BatchThread.complete flag, which is checked in the cycle. Initial 2 hours test has shown 0 hanged threads, we started long stability test, however I think this fix should be enough to correct the problem.