/** * This lock has just been granted to a new thread (the thread waited for it). * Remove the request from the queue and update both the graph and the lock. */ private synchronized void updateCurrentOperation() { operations.dequeue(); setCurrentOperationThread(Thread.currentThread()); } }
/** * This lock has just been granted to a new thread (the thread waited for it). * Remove the request from the queue and update both the graph and the lock. */ private synchronized void updateCurrentOperation() { operations.dequeue(); setCurrentOperationThread(Thread.currentThread()); }
/** * This lock has just been granted to a new thread (the thread waited for it). * Remove the request from the queue and update both the graph and the lock. */ private synchronized void updateCurrentOperation() { operations.dequeue(); setCurrentOperationThread(Thread.currentThread()); }
/** * This lock has just been granted to a new thread (the thread waited for it). * Remove the request from the queue and update both the graph and the lock. */ private synchronized void updateCurrentOperation() { operations.dequeue(); setCurrentOperationThread(Thread.currentThread()); }
/** * Attempts to acquire the lock. Returns false if the lock is not available and * true if the lock has been successfully acquired. */ private synchronized boolean attempt() { //return true if we already own the lock //also, if nobody is waiting, grant the lock immediately if ((currentOperationThread == Thread.currentThread()) || (currentOperationThread == null && operations.isEmpty())) { depth++; setCurrentOperationThread(Thread.currentThread()); return true; } return false; }
/** * Attempts to acquire the lock. Returns false if the lock is not available and * true if the lock has been successfully acquired. */ private synchronized boolean attempt() { //return true if we already own the lock //also, if nobody is waiting, grant the lock immediately if ((currentOperationThread == Thread.currentThread()) || (currentOperationThread == null && operations.isEmpty())) { depth++; setCurrentOperationThread(Thread.currentThread()); return true; } return false; }
/** * Attempts to acquire the lock. Returns false if the lock is not available and * true if the lock has been successfully acquired. */ private synchronized boolean attempt() { //return true if we already own the lock //also, if nobody is waiting, grant the lock immediately if ((currentOperationThread == Thread.currentThread()) || (currentOperationThread == null && operations.isEmpty())) { depth++; setCurrentOperationThread(Thread.currentThread()); return true; } return false; }
/** * Attempts to acquire the lock. Returns false if the lock is not available and * true if the lock has been successfully acquired. */ private synchronized boolean attempt() { //return true if we already own the lock //also, if nobody is waiting, grant the lock immediately if ((currentOperationThread == Thread.currentThread()) || (currentOperationThread == null && operations.isEmpty())) { depth++; setCurrentOperationThread(Thread.currentThread()); return true; } return false; }
/** * Releases this lock from the thread that used to own it. * Grants this lock to the next thread in the queue. */ private synchronized void doRelease() { //notify hook manager.aboutToRelease(); depth = 0; Semaphore next = (Semaphore) operations.peek(); setCurrentOperationThread(null); if (next != null) next.release(); }
/** * Releases this lock from the thread that used to own it. * Grants this lock to the next thread in the queue. */ private synchronized void doRelease() { //notify hook manager.aboutToRelease(); depth = 0; Semaphore next = (Semaphore) operations.peek(); setCurrentOperationThread(null); if (next != null) next.release(); }
/** * Releases this lock from the thread that used to own it. * Grants this lock to the next thread in the queue. */ private synchronized void doRelease() { //notify hook manager.aboutToRelease(); depth = 0; Semaphore next = (Semaphore) operations.peek(); setCurrentOperationThread(null); if (next != null) next.release(); }
/** * Releases this lock from the thread that used to own it. * Grants this lock to the next thread in the queue. */ private synchronized void doRelease() { //notify hook manager.aboutToRelease(); depth = 0; Semaphore next = (Semaphore) operations.peek(); setCurrentOperationThread(null); if (next != null) next.release(); }