/** {@inheritDoc} */ @Override public boolean tryAcquire() { ctx.kernalContext().gateway().readLock(); try { initializeSemaphore(); boolean res = sync.nonfairTryAcquireShared(1) >= 0; if (isBroken()) { Thread.interrupted(); // Clear interrupt flag. throw new InterruptedException(); } return res; } catch (IgniteCheckedException e) { throw U.convertException(e); } catch (InterruptedException e) { throw new IgniteInterruptedException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public boolean tryAcquire() { ctx.kernalContext().gateway().readLock(); try { initializeSemaphore(); boolean res = sync.nonfairTryAcquireShared(1) >= 0; if (isBroken()) { Thread.interrupted(); // Clear interrupt flag. throw new InterruptedException(); } return res; } catch (IgniteCheckedException e) { throw U.convertException(e); } catch (InterruptedException e) { throw new IgniteInterruptedException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public boolean tryAcquire(int permits) { ctx.kernalContext().gateway().readLock(); A.ensure(permits >= 0, "Number of permits must be non-negative."); try { initializeSemaphore(); return sync.nonfairTryAcquireShared(permits) >= 0; } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override protected int tryAcquireShared(int acquires) { return nonfairTryAcquireShared(acquires); }
/** {@inheritDoc} */ @Override public boolean tryAcquire(int permits) { ctx.kernalContext().gateway().readLock(); A.ensure(permits >= 0, "Number of permits must be non-negative."); try { initializeSemaphore(); return sync.nonfairTryAcquireShared(permits) >= 0; } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override protected int tryAcquireShared(int acquires) { return nonfairTryAcquireShared(acquires); }