synchronized boolean checkIncomingSignals(GridCacheLockState state) { if (state.getSignals() == null) return false; LinkedList<String> signals = state.getSignals().get(thisNode); if (signals == null || signals.isEmpty()) return false; UUID tempUUID = getOwnerNode(); Thread tempThread = getExclusiveOwnerThread(); long tempThreadID = currentOwnerThreadId; // Temporarily allow current thread to signal condition object. // This is safe to do because: // 1. if release was called on this node, // it was called from currently active thread; // 2. if release came from a thread on any other node, // all threads on this node are already blocked. setCurrentOwnerNode(thisNode); setExclusiveOwnerThread(Thread.currentThread()); currentOwnerThreadId = Thread.currentThread().getId(); for (String signal: signals) conditionMap.get(signal).signal(); // Restore owner node and owner thread. setCurrentOwnerNode(tempUUID); setExclusiveOwnerThread(tempThread); currentOwnerThreadId = tempThreadID; return true; }
synchronized boolean checkIncomingSignals(GridCacheLockState state) { if (state.getSignals() == null) return false; LinkedList<String> signals = state.getSignals().get(thisNode); if (signals == null || signals.isEmpty()) return false; UUID tempUUID = getOwnerNode(); Thread tempThread = getExclusiveOwnerThread(); long tempThreadID = currentOwnerThreadId; // Temporarily allow current thread to signal condition object. // This is safe to do because: // 1. if release was called on this node, // it was called from currently active thread; // 2. if release came from a thread on any other node, // all threads on this node are already blocked. setCurrentOwnerNode(thisNode); setExclusiveOwnerThread(Thread.currentThread()); currentOwnerThreadId = Thread.currentThread().getId(); for (String signal: signals) conditionMap.get(signal).signal(); // Restore owner node and owner thread. setCurrentOwnerNode(tempUUID); setExclusiveOwnerThread(tempThread); currentOwnerThreadId = tempThreadID; return true; }