public synchronized Object waitForObject(){ try { int count = 0; while (this.object == null && isAcquired()) { if (count > MAX_WAIT_TRIES) throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(getActiveThread(), Thread.currentThread()); wait(10); ++count; } } catch(InterruptedException ex) { //ignore as the loop is broken } return this.object; } }
public synchronized Object waitForObject(){ try { int count = 0; while (this.object == null && isAcquired()) { if (count > MAX_WAIT_TRIES) throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(getActiveThread(), Thread.currentThread()); wait(10); ++count; } } catch(InterruptedException ex) { //ignore as the loop is broken } return this.object; } }
public Object waitForObject(){ synchronized (getMutex()) { try{ int count = 0; while(this.object == null && this.isAcquired()){ if (count > MAX_WAIT_TRIES) throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(getMutex().getActiveThread(), Thread.currentThread()); getMutex().wait(10); ++count; } }catch(InterruptedException ex){ //ignore as the loop is broken } return this.object; } } }
public void acquireLock(ObjectBuildingQuery query){ // PERF: Only use deferred locking if required. // CR#3876308 If joining is used, deferred locks are still required. if (query.requiresDeferredLocks()) { this.acquireDeferredLock(); int counter = 0; while ((this.object == null) && (counter < 1000)) { if (this.getActiveThread() == Thread.currentThread()) { break; } //must release lock here to prevent acquiring multiple deferred locks but only //releasing one at the end of the build object call. //bug 5156075 this.releaseDeferredLock(); //sleep and try again if we are not the owner of the lock for CR 2317 // prevents us from modifying a cache key that another thread has locked. try { Thread.sleep(10); } catch (InterruptedException exception) { } this.acquireDeferredLock(); counter++; } if (counter == 1000) { throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(this.getActiveThread(), Thread.currentThread()); } } else { this.acquire(); } }
throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(this.getActiveThread(), Thread.currentThread());
throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(cacheKey.getActiveThread(), Thread.currentThread());
throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(cacheKey.getActiveThread(), Thread.currentThread());
throw ConcurrencyException.maxTriesLockOnBuildObjectExceded(cacheKey.getMutex().getActiveThread(), Thread.currentThread());