/** * Returns true if the workspace lock has already been acquired by this * thread, and false otherwise. */ public boolean isLockAlreadyAcquired() { boolean result = false; try { boolean success = lock.acquire(0L); if (success) { //if lock depth is greater than one, then we already owned it // before result = lock.getDepth() > 1; lock.release(); } } catch (InterruptedException e) { // ignore } return result; }
/** * Releases the workspace lock without changing the nested operation depth. * Must be followed eventually by endUnprotected. Any * beginUnprotected/endUnprotected pair must be done entirely within the * scope of a checkIn/checkOut pair. Returns the old lock depth. * @see #endUnprotected(int) */ public int beginUnprotected() { int depth = lock.getDepth(); for (int i = 0; i < depth; i++) lock.release(); return depth; }
/** * Re-acquires the workspace lock that was temporarily released during an * operation, and restores the old lock depth. * @see #beginUnprotected() */ public void endUnprotected(int depth) { for (int i = 0; i < depth; i++) lock.acquire(); }
private void endOperation() { lock.release(); }
/** * A project alias needs updating. If the project location has been deleted, * then the project should be deleted from the workspace. This differs * from the refresh local strategy, but operations performed from within * the workspace must never leave a resource out of sync. * @param project The project to check for deletion * @param location The project location * @return <code>true</code> if the project has been deleted, and <code>false</code> otherwise * @exception CoreException */ private boolean checkDeletion(Project project, IFileStore location) throws CoreException { if (project.exists() && !location.fetchInfo().exists()) { //perform internal deletion of project from workspace tree because // it is already deleted from disk and we can't acquire a different //scheduling rule in this context (none is needed because we are //within scope of the workspace lock) Assert.isTrue(workspace.getWorkManager().getLock().getDepth() > 0); project.deleteResource(false, null); return true; } return false; }
/** * Re-acquires the workspace lock that was temporarily released during an * operation, and restores the old lock depth. * @see #beginUnprotected() */ public void endUnprotected(int depth) { for (int i = 0; i < depth; i++) lock.acquire(); }
/** * Releases the workspace lock without changing the nested operation depth. * Must be followed eventually by endUnprotected. Any * beginUnprotected/endUnprotected pair must be done entirely within the * scope of a checkIn/checkOut pair. Returns the old lock depth. * @see #endUnprotected(int) */ public int beginUnprotected() { int depth = lock.getDepth(); for (int i = 0; i < depth; i++) lock.release(); return depth; }
private void releaseSaveLock() { // System.out.println("FileName: " + getFile().getName() + " " +getFile()); // System.out.println("releasedSaveLock: " + Thread.currentThread().getName()); // System.out.println("Depth" + getSaveLock().getDepth()); // System.out.println("Instance:"+getSaveLock().hashCode()); // new Exception().printStackTrace(System.out); getSaveLock().release(); }
/** * A project alias needs updating. If the project location has been deleted, * then the project should be deleted from the workspace. This differs * from the refresh local strategy, but operations performed from within * the workspace must never leave a resource out of sync. * @param project The project to check for deletion * @param location The project location * @return <code>true</code> if the project has been deleted, and <code>false</code> otherwise * @exception CoreException */ private boolean checkDeletion(Project project, IFileStore location) throws CoreException { if (project.exists() && !location.fetchInfo().exists()) { //perform internal deletion of project from workspace tree because // it is already deleted from disk and we can't acquire a different //scheduling rule in this context (none is needed because we are //within scope of the workspace lock) Assert.isTrue(workspace.getWorkManager().getLock().getDepth() > 0); project.deleteResource(false, null); return true; } return false; }
@Override public IStatus run(IProgressMonitor monitor) { // wait until the test run terminates m_runLock.acquire(); return Status.OK_STATUS; }
/** * Returns true if the workspace lock has already been acquired by this * thread, and false otherwise. */ public boolean isLockAlreadyAcquired() { boolean result = false; try { boolean success = lock.acquire(0L); if (success) { //if lock depth is greater than one, then we already owned it // before result = lock.getDepth() > 1; lock.release(); } } catch (InterruptedException e) { // ignore } return result; }
/** * Releases the workspace lock without changing the nested operation depth. * Must be followed eventually by endUnprotected. Any * beginUnprotected/endUnprotected pair must be done entirely within the * scope of a checkIn/checkOut pair. Returns the old lock depth. * @see #endUnprotected(int) */ public int beginUnprotected() { int depth = lock.getDepth(); for (int i = 0; i < depth; i++) lock.release(); return depth; }
private void endOperation() { // See beginOperation() for a description of why the lock is not obtained when the tree is locked if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; lock.release(); }
/** * A project alias needs updating. If the project location has been deleted, * then the project should be deleted from the workspace. This differs * from the refresh local strategy, but operations performed from within * the workspace must never leave a resource out of sync. * @param project The project to check for deletion * @param location The project location * @return <code>true</code> if the project has been deleted, and <code>false</code> otherwise * @exception CoreException */ private boolean checkDeletion(Project project, IFileStore location) throws CoreException { if (project.exists() && !location.fetchInfo().exists()) { //perform internal deletion of project from workspace tree because // it is already deleted from disk and we can't acquire a different //scheduling rule in this context (none is needed because we are //within scope of the workspace lock) Assert.isTrue(workspace.getWorkManager().getLock().getDepth() > 0); project.deleteResource(false, null); return true; } return false; }
/** * Re-acquires the workspace lock that was temporarily released during an * operation, and restores the old lock depth. * @see #beginUnprotected() */ public void endUnprotected(int depth) { for (int i = 0; i < depth; i++) lock.acquire(); }
/** * Returns true if the workspace lock has already been acquired by this * thread, and false otherwise. */ public boolean isLockAlreadyAcquired() { boolean result = false; try { boolean success = lock.acquire(0L); if (success) { //if lock depth is greater than one, then we already owned it // before result = lock.getDepth() > 1; lock.release(); } } catch (InterruptedException e) { // ignore } return result; }