/** * The given thread has stopped waiting for the given lock. * Update the graph. * If the lock has already been granted, then it isn't removed. */ void lockWaitStop(Thread owner, ISchedulingRule lock) { int lockIndex = indexOf(lock, false); int threadIndex = indexOf(owner, false); //make sure the thread and lock exist in the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Thread " + owner.getName() + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (lockIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (graph[threadIndex][lockIndex] != WAITING_FOR_LOCK) { // Lock has already been granted, nothing to do... if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " already granted to depth: " + graph[threadIndex][lockIndex]); //$NON-NLS-1$ //$NON-NLS-2$ return; } graph[threadIndex][lockIndex] = NO_STATE; reduceGraph(threadIndex, lock); }
/** * The given scheduling rule is no longer used because the job that invoked it is done. * Release this rule regardless of how many times it was acquired. */ void lockReleasedCompletely(Thread owner, ISchedulingRule rule) { int ruleIndex = indexOf(rule, false); int threadIndex = indexOf(owner, false); //need to make sure that the given thread and rule were not already removed from the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Lock " + rule + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (ruleIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Thread " + owner.getName() + " already released lock " + rule); //$NON-NLS-1$ //$NON-NLS-2$ return; } /** * set all rules that are owned by the given thread to NO_STATE * (not just rules that conflict with the rule we are releasing) * if we are releasing a lock, then only update the one entry for the lock */ for (int j = 0; j < graph[threadIndex].length; j++) { if (!(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE)) graph[threadIndex][j] = NO_STATE; } reduceGraph(threadIndex, rule); }
/** * The given scheduling rule is no longer used because the job that invoked it is done. * Release this rule regardless of how many times it was acquired. */ void lockReleasedCompletely(Thread owner, ISchedulingRule rule) { int ruleIndex = indexOf(rule, false); int threadIndex = indexOf(owner, false); //need to make sure that the given thread and rule were not already removed from the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Lock " + rule + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (ruleIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Thread " + owner.getName() + " already released lock " + rule); //$NON-NLS-1$ //$NON-NLS-2$ return; } /** * set all rules that are owned by the given thread to NO_STATE * (not just rules that conflict with the rule we are releasing) * if we are releasing a lock, then only update the one entry for the lock */ for (int j = 0; j < graph[threadIndex].length; j++) { if (!(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE)) graph[threadIndex][j] = NO_STATE; } reduceGraph(threadIndex, rule); }
/** * The given thread has stopped waiting for the given lock. * Update the graph. * If the lock has already been granted, then it isn't removed. */ void lockWaitStop(Thread owner, ISchedulingRule lock) { int lockIndex = indexOf(lock, false); int threadIndex = indexOf(owner, false); //make sure the thread and lock exist in the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Thread " + owner.getName() + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (lockIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (graph[threadIndex][lockIndex] != WAITING_FOR_LOCK) { // Lock has already been granted, nothing to do... if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " already granted to depth: " + graph[threadIndex][lockIndex]); //$NON-NLS-1$ //$NON-NLS-2$ return; } graph[threadIndex][lockIndex] = NO_STATE; reduceGraph(threadIndex, lock); }
/** * The given scheduling rule is no longer used because the job that invoked it is done. * Release this rule regardless of how many times it was acquired. */ void lockReleasedCompletely(Thread owner, ISchedulingRule rule) { int ruleIndex = indexOf(rule, false); int threadIndex = indexOf(owner, false); //need to make sure that the given thread and rule were not already removed from the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Lock " + rule + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (ruleIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Thread " + owner.getName() + " already released lock " + rule); //$NON-NLS-1$ //$NON-NLS-2$ return; } /** * set all rules that are owned by the given thread to NO_STATE * (not just rules that conflict with the rule we are releasing) * if we are releasing a lock, then only update the one entry for the lock */ for (int j = 0; j < graph[threadIndex].length; j++) { if (!(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE)) graph[threadIndex][j] = NO_STATE; } reduceGraph(threadIndex, rule); }
/** * The given scheduling rule is no longer used because the job that invoked it is done. * Release this rule regardless of how many times it was acquired. */ void lockReleasedCompletely(Thread owner, ISchedulingRule rule) { int ruleIndex = indexOf(rule, false); int threadIndex = indexOf(owner, false); //need to make sure that the given thread and rule were not already removed from the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Lock " + rule + " was already released by thread " + owner.getName()); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (ruleIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("[lockReleasedCompletely] Thread " + owner.getName() + " already released lock " + rule); //$NON-NLS-1$ //$NON-NLS-2$ return; } /** * set all rules that are owned by the given thread to NO_STATE * (not just rules that conflict with the rule we are releasing) * if we are releasing a lock, then only update the one entry for the lock */ for (int j = 0; j < graph[threadIndex].length; j++) { if (!(locks.get(j) instanceof ILock) && (graph[threadIndex][j] > NO_STATE)) graph[threadIndex][j] = NO_STATE; } reduceGraph(threadIndex, rule); }
/** * The given thread has stopped waiting for the given lock. * Update the graph. * If the lock has already been granted, then it isn't removed. */ void lockWaitStop(Thread owner, ISchedulingRule lock) { int lockIndex = indexOf(lock, false); int threadIndex = indexOf(owner, false); //make sure the thread and lock exist in the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Thread " + owner.getName() + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (lockIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (graph[threadIndex][lockIndex] != WAITING_FOR_LOCK) { // Lock has already been granted, nothing to do... if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " already granted to depth: " + graph[threadIndex][lockIndex]); //$NON-NLS-1$ //$NON-NLS-2$ return; } graph[threadIndex][lockIndex] = NO_STATE; reduceGraph(threadIndex, lock); }
/** * The given thread has stopped waiting for the given lock. * Update the graph. */ void lockWaitStop(Thread owner, ISchedulingRule lock) { int lockIndex = indexOf(lock, false); int threadIndex = indexOf(owner, false); //make sure the thread and lock exist in the graph if (threadIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Thread " + owner.getName() + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (lockIndex < 0) { if (JobManager.DEBUG_LOCKS) System.out.println("Lock " + lock + " was already removed."); //$NON-NLS-1$ //$NON-NLS-2$ return; } if (graph[threadIndex][lockIndex] != WAITING_FOR_LOCK) Assert.isTrue(false, "Thread " + owner.getName() + " was not waiting for lock " + lock.toString() + " so it could not time out."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ graph[threadIndex][lockIndex] = NO_STATE; reduceGraph(threadIndex, lock); }
reduceGraph(threadIndex, lock);
reduceGraph(threadIndex, lock);
reduceGraph(threadIndex, lock);
reduceGraph(threadIndex, lock);