/** * Returns true IFF the given thread owns a single lock */ private boolean ownsLocks(Thread cause) { int threadIndex = indexOf(cause, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) return true; } return false; }
/** * Returns true IFF the given thread owns a single lock */ private boolean ownsLocks(Thread cause) { int threadIndex = indexOf(cause, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) return true; } return false; }
/** * Returns true IFF the given thread owns a single lock */ private boolean ownsLocks(Thread cause) { int threadIndex = indexOf(cause, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) return true; } return false; }
/** * Returns true IFF the given thread owns a single lock */ private boolean ownsLocks(Thread cause) { int threadIndex = indexOf(cause, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) return true; } return false; }
/** * Returns the lock the given thread is waiting for. */ private Object getWaitingLock(Thread current) { int index = indexOf(current, false); //find the lock that this thread is waiting for for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] == WAITING_FOR_LOCK) return locks.get(j); } //it can happen that a thread is not waiting for any lock (it is not really part of the deadlock) return null; }
/** * Returns the lock the given thread is waiting for. */ private Object getWaitingLock(Thread current) { int index = indexOf(current, false); //find the lock that this thread is waiting for for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] == WAITING_FOR_LOCK) return locks.get(j); } //it can happen that a thread is not waiting for any lock (it is not really part of the deadlock) return null; }
/** * Returns the lock the given thread is waiting for. */ private Object getWaitingLock(Thread current) { int index = indexOf(current, false); //find the lock that this thread is waiting for for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] == WAITING_FOR_LOCK) return locks.get(j); } //it can happen that a thread is not waiting for any lock (it is not really part of the deadlock) return null; }
/** * Returns the lock the given thread is waiting for. */ private Object getWaitingLock(Thread current) { int index = indexOf(current, false); //find the lock that this thread is waiting for for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] == WAITING_FOR_LOCK) return locks.get(j); } //it can happen that a thread is not waiting for any lock (it is not really part of the deadlock) return null; }
/** * Return true IFF this thread owns rule locks (i.e. implicit locks which * cannot be suspended) */ private boolean ownsRuleLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (!(lock instanceof ILock)) return true; } } return false; }
/** * Returns true IFF the given thread owns a single real lock. * A real lock is a lock that can be suspended. */ private boolean ownsRealLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (lock instanceof ILock) return true; } } return false; }
/** * Returns true IFF the given thread owns a single real lock. * A real lock is a lock that can be suspended. */ private boolean ownsRealLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (lock instanceof ILock) return true; } } return false; }
/** * Return true IFF this thread owns rule locks (i.e. implicit locks which * cannot be suspended) */ private boolean ownsRuleLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (!(lock instanceof ILock)) return true; } } return false; }
/** * Return true IFF this thread owns rule locks (i.e. implicit locks which * cannot be suspended) */ private boolean ownsRuleLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (!(lock instanceof ILock)) return true; } } return false; }
/** * Returns true IFF the given thread owns a single real lock. * A real lock is a lock that can be suspended. */ private boolean ownsRealLocks(Thread owner) { int threadIndex = indexOf(owner, false); for (int j = 0; j < graph[threadIndex].length; j++) { if (graph[threadIndex][j] > NO_STATE) { Object lock = locks.get(j); if (lock instanceof ILock) return true; } } return false; }
/** * Returns all the locks owned by the given thread */ private Object[] getOwnedLocks(Thread current) { ArrayList<ISchedulingRule> ownedLocks = new ArrayList<>(1); int index = indexOf(current, false); for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] > NO_STATE) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no locks is part of a deadlock."); //$NON-NLS-1$ return ownedLocks.toArray(); }
/** * Returns all the locks owned by the given thread */ private Object[] getOwnedLocks(Thread current) { ArrayList<ISchedulingRule> ownedLocks = new ArrayList<ISchedulingRule>(1); int index = indexOf(current, false); for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] > NO_STATE) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no locks is part of a deadlock."); //$NON-NLS-1$ return ownedLocks.toArray(); }
/** * Returns all the locks owned by the given thread */ private Object[] getOwnedLocks(Thread current) { ArrayList ownedLocks = new ArrayList(1); int index = indexOf(current, false); for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] > NO_STATE) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no locks is part of a deadlock."); //$NON-NLS-1$ return ownedLocks.toArray(); }
/** * Returns all the locks owned by the given thread */ private Object[] getOwnedLocks(Thread current) { ArrayList ownedLocks = new ArrayList(1); int index = indexOf(current, false); for (int j = 0; j < graph[index].length; j++) { if (graph[index][j] > NO_STATE) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no locks is part of a deadlock."); //$NON-NLS-1$ return ownedLocks.toArray(); }
/** * Returns an array of real locks that are owned by the given thread. * Real locks are locks that implement the ILock interface and can be suspended. */ private ISchedulingRule[] realLocksForThread(Thread owner) { int threadIndex = indexOf(owner, false); ArrayList ownedLocks = new ArrayList(1); for (int j = 0; j < graph[threadIndex].length; j++) { if ((graph[threadIndex][j] > NO_STATE) && (locks.get(j) instanceof ILock)) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no real locks was chosen to resolve deadlock."); //$NON-NLS-1$ return (ISchedulingRule[]) ownedLocks.toArray(new ISchedulingRule[ownedLocks.size()]); }
/** * Returns an array of real locks that are owned by the given thread. * Real locks are locks that implement the ILock interface and can be suspended. */ private ISchedulingRule[] realLocksForThread(Thread owner) { int threadIndex = indexOf(owner, false); ArrayList<ISchedulingRule> ownedLocks = new ArrayList<ISchedulingRule>(1); for (int j = 0; j < graph[threadIndex].length; j++) { if ((graph[threadIndex][j] > NO_STATE) && (locks.get(j) instanceof ILock)) ownedLocks.add(locks.get(j)); } if (ownedLocks.size() == 0) Assert.isLegal(false, "A thread with no real locks was chosen to resolve deadlock."); //$NON-NLS-1$ return ownedLocks.toArray(new ISchedulingRule[ownedLocks.size()]); }