/** * Wait on any writer. * Allow concurrent reads. */ public synchronized void acquireReadLock() throws ConcurrencyException { // Cannot check for starving writers as will lead to deadlocks. while ((this.activeThread != null) && (this.activeThread != Thread.currentThread())) { try { wait(); } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } this.numberOfReaders++; }
/** * Wait on any writer. * Allow concurrent reads. */ public synchronized void acquireReadLock() throws ConcurrencyException { // Cannot check for starving writers as will lead to deadlocks. while ((this.activeThread != null) && (this.activeThread != Thread.currentThread())) { try { wait(); } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } this.numberOfReaders++; }
/** * Wait on any writer. * Allow concurrent reads. */ public synchronized void acquireReadLock() throws ConcurrencyException { // Cannot check for starving writers as will lead to deadlocks. while ((this.activeThread != null) && (this.activeThread != Thread.currentThread())) { try { wait(); } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } this.numberOfReaders++; }
/** * Wait for all threads except the active thread. * If the active thread just increment the depth. * This should be called before entering a critical section. * called with true from the merge process, if true then the refresh will not refresh the object */ public synchronized void acquire(boolean forMerge) throws ConcurrencyException { while (((this.activeThread != null) || (this.numberOfReaders > 0)) && (this.activeThread != Thread.currentThread())) { // This must be in a while as multiple threads may be released, or another thread may rush the acquire after one is released. try { this.numberOfWritersWaiting++; wait(); this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } if (this.activeThread == null) { this.activeThread = Thread.currentThread(); } this.lockedByMergeManager = forMerge; this.depth++; }
/** * Wait for all threads except the active thread. * If the active thread just increment the depth. * This should be called before entering a critical section. * called with true from the merge process, if true then the refresh will not refresh the object */ public synchronized void acquire(boolean forMerge) throws ConcurrencyException { while (((this.activeThread != null) || (this.numberOfReaders > 0)) && (this.activeThread != Thread.currentThread())) { // This must be in a while as multiple threads may be released, or another thread may rush the acquire after one is released. try { this.numberOfWritersWaiting++; wait(); this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } if (this.activeThread == null) { this.activeThread = Thread.currentThread(); if (shouldTrackStack){ this.stack = new Exception(); } } this.lockedByMergeManager = forMerge; this.depth++; }
/** * Wait for all threads except the active thread. * If the active thread just increment the depth. * This should be called before entering a critical section. * called with true from the merge process, if true then the refresh will not refresh the object */ public synchronized void acquire(boolean forMerge) throws ConcurrencyException { while (((this.activeThread != null) || (this.numberOfReaders > 0)) && (this.activeThread != Thread.currentThread())) { // This must be in a while as multiple threads may be released, or another thread may rush the acquire after one is released. try { this.numberOfWritersWaiting++; wait(); this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage()); } } if (this.activeThread == null) { this.activeThread = Thread.currentThread(); if (shouldTrackStack){ this.stack = new Exception(); } } this.lockedByMergeManager = forMerge; this.depth++; }
this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage());
this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage());
this.numberOfWritersWaiting--; } catch (InterruptedException exception) { throw ConcurrencyException.waitWasInterrupted(exception.getMessage());
lockManager.releaseActiveLocksOnThread(); removeDeferredLockManager(currentThread); throw ConcurrencyException.waitWasInterrupted(interrupted.getMessage());
lockManager.releaseActiveLocksOnThread(); removeDeferredLockManager(currentThread); throw ConcurrencyException.waitWasInterrupted(interrupted.getMessage());
throw org.eclipse.persistence.exceptions.ConcurrencyException.waitWasInterrupted(exception.getMessage());
throw org.eclipse.persistence.exceptions.ConcurrencyException.waitWasInterrupted(exception.getMessage());
throw org.eclipse.persistence.exceptions.ConcurrencyException.waitWasInterrupted(exception.getMessage());