/** {@inheritDoc} */ @Override public void onNodeRemoved(UUID nodeId) { updateLock.lock(); try { if (nodeId.equals(sync.getOwnerNode())) { if (!sync.failoverSafe) { sync.setBroken(true); sync.interruptAll(); } } // Try to notify any waiting threads. sync.release(0); } finally { updateLock.unlock(); } }
sync.release(0);
sync.release(0);
/** {@inheritDoc} */ @Override public void onUpdate(GridCacheLockState val) { // Called only on initialization, so it's safe to ignore update. if (sync == null) return; updateLock.lock(); try { // If this update is a result of unsuccessful acquire in fair mode, no local update should be done. if (!val.isChanged()) return; // Check if update came from this node. boolean loc = sync.isLockedLocally(val.getId()); // Process any incoming signals. boolean incomingSignals = sync.checkIncomingSignals(val); // Update permission count. sync.setPermits(val.get()); // Update owner's node id. sync.setCurrentOwnerNode(val.getId()); // Update owner's thread id. sync.setCurrentOwnerThread(val.getThreadId()); // Check if any threads waiting on this node need to be notified. if ((incomingSignals || sync.getPermits() == 0) && !loc) { // Try to notify any waiting threads. sync.release(0); } } finally{ updateLock.unlock(); } }
/** {@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 onNodeRemoved(UUID nodeId) { updateLock.lock(); try { if (nodeId.equals(sync.getOwnerNode())) { if (!sync.failoverSafe) { sync.setBroken(true); sync.interruptAll(); } } // Try to notify any waiting threads. sync.release(0); } finally { updateLock.unlock(); } }
/** {@inheritDoc} */ @Override public void onStop() { if (sync == null) { interruptAll = true; return; } if (!sync.failoverSafe) { sync.setBroken(true); } sync.interruptAll(); // Try to notify any waiting threads. sync.release(0); }
/** {@inheritDoc} */ @Override public void onUpdate(GridCacheLockState val) { // Called only on initialization, so it's safe to ignore update. if (sync == null) return; updateLock.lock(); try { // If this update is a result of unsuccessful acquire in fair mode, no local update should be done. if (!val.isChanged()) return; // Check if update came from this node. boolean loc = sync.isLockedLocally(val.getId()); // Process any incoming signals. boolean incomingSignals = sync.checkIncomingSignals(val); // Update permission count. sync.setPermits(val.get()); // Update owner's node id. sync.setCurrentOwnerNode(val.getId()); // Update owner's thread id. sync.setCurrentOwnerThread(val.getThreadId()); // Check if any threads waiting on this node need to be notified. if ((incomingSignals || sync.getPermits() == 0) && !loc) { // Try to notify any waiting threads. sync.release(0); } } finally{ updateLock.unlock(); } }
/** {@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 onStop() { if (sync == null) { interruptAll = true; return; } if (!sync.failoverSafe) { sync.setBroken(true); } sync.interruptAll(); // Try to notify any waiting threads. sync.release(0); }