public static void attemptObtain(ObtainableLock lock) throws IOException { int attempts = 0; while (!lock.obtain()) { //we could fail immediately, but being Infinispan a bit latency sensitive we give a bit of grace here if (attempts++ > MAX_LOCK_ACQUIRE_MILLISECONDS) failLockAcquire(); if (Thread.currentThread().isInterrupted()) failLockAcquire(); try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); failLockAcquire(); } } }
public static void attemptObtain(ObtainableLock lock) throws IOException { int attempts = 0; while (!lock.obtain()) { //we could fail immediately, but being Infinispan a bit latency sensitive we give a bit of grace here if (attempts++ > MAX_LOCK_ACQUIRE_MILLISECONDS) failLockAcquire(); if (Thread.currentThread().isInterrupted()) failLockAcquire(); try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); failLockAcquire(); } } }