refs #7175
Change-Id: If9505ec6b79aeee38971f523bb6f1909493abd81
boolean gotMutex = impl.tryAcquireMutex();
boolean done = false;
boolean gotMutex = impl.tryAcquireMutex();
boolean done = false;
- // TODO: fix this properly pleease
while (!done) {
if (gotMutex || borrowMutex) {
runWithMutex();
done = true;
} else {
while (!done) {
if (gotMutex || borrowMutex) {
runWithMutex();
done = true;
} else {
+ if (count % 10 == 0) {
+ // Taking too long, sleep for a while.
LOGGER.warn("Retry mutex acquire");
LOGGER.warn("Retry mutex acquire");
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ }
+ }
gotMutex = impl.tryAcquireMutex();
gotMutex = impl.tryAcquireMutex();
+ long currentTime = System.currentTimeMillis();
+ if ((currentTime - startTime) > 10) {
+ startTime = currentTime;
+ count++;
+ }