@Override public boolean isFair() { try{ initializeReentrantLock(); return sync.fair; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
@Override public boolean isFailoverSafe() { try{ initializeReentrantLock(); return sync.failoverSafe; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public int getHoldCount() { try{ initializeReentrantLock(); return sync.getHoldCount(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean isBroken() { try{ initializeReentrantLock(); return sync.isBroken(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean hasQueuedThreads() { try{ initializeReentrantLock(); return sync.hasQueuedThreads(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean hasWaiters(IgniteCondition condition) { try{ initializeReentrantLock(); AbstractQueuedSynchronizer.ConditionObject c = sync.conditionMap.get(condition.name()); if (c == null) throw new IllegalArgumentException(); return sync.hasWaiters(c); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean isHeldByCurrentThread() { try{ initializeReentrantLock(); return sync.isHeldExclusively(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean isLocked() { try{ initializeReentrantLock(); return sync.isLocked(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean hasQueuedThread(Thread thread) { try{ initializeReentrantLock(); return sync.isQueued(thread); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public int getWaitQueueLength(IgniteCondition condition) { try{ initializeReentrantLock(); AbstractQueuedSynchronizer.ConditionObject c = sync.conditionMap.get(condition.name()); if (c == null) throw new IllegalArgumentException(); return sync.getWaitQueueLength(c); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean tryLock(long timeout, TimeUnit unit) throws IgniteInterruptedException { ctx.kernalContext().gateway().readLock(); try{ initializeReentrantLock(); boolean result = sync.tryAcquireNanos(1, unit.toNanos(timeout)); sync.validate(true); return result; } catch (IgniteCheckedException e) { throw U.convertException(e); } catch (InterruptedException e) { if (sync.fair) sync.synchronizeQueue(true, Thread.currentThread()); throw new IgniteInterruptedException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public void lockInterruptibly() throws IgniteInterruptedException { ctx.kernalContext().gateway().readLock(); try { initializeReentrantLock(); sync.acquireInterruptibly(1); sync.validate(true); } catch (IgniteCheckedException e) { throw U.convertException(e); } catch (InterruptedException e) { if (sync.fair) sync.synchronizeQueue(true, Thread.currentThread()); throw new IgniteInterruptedException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public IgniteCondition getOrCreateCondition(String name) { ctx.kernalContext().gateway().readLock(); try{ initializeReentrantLock(); IgniteCondition result = sync.newCondition(name); sync.validate(false); return result; } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public boolean tryLock() { ctx.kernalContext().gateway().readLock(); try{ initializeReentrantLock(); boolean result = sync.tryAcquire(1, false); sync.validate(false); return result; } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public void unlock() { ctx.kernalContext().gateway().readLock(); try{ initializeReentrantLock(); // Validate before release. sync.validate(false); sync.release(1); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
/** {@inheritDoc} */ @Override public void lock() { ctx.kernalContext().gateway().readLock(); try{ initializeReentrantLock(); sync.lock(); sync.validate(false); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { ctx.kernalContext().gateway().readUnlock(); } }
@Override public boolean isFailoverSafe() { try{ initializeReentrantLock(); return sync.failoverSafe; } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean hasQueuedThreads() { try{ initializeReentrantLock(); return sync.hasQueuedThreads(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean isHeldByCurrentThread() { try{ initializeReentrantLock(); return sync.isHeldExclusively(); } catch (IgniteCheckedException e) { throw U.convertException(e); } }
/** {@inheritDoc} */ @Override public boolean hasQueuedThread(Thread thread) { try{ initializeReentrantLock(); return sync.isQueued(thread); } catch (IgniteCheckedException e) { throw U.convertException(e); } }