public boolean execute(IProgressMonitor progressMonitor) { if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) return true; /* ensure no concurrent write access to index */ Index index = this.manager.getIndex( this.containerPath, true /*reuse index file*/, false /*don't create if none*/); if (index == null) return true; ReadWriteMonitor monitor = index.monitor; if (monitor == null) return true; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write this.manager.saveIndex(index); } catch (IOException e) { if (JobManager.VERBOSE) { Util.verbose( "-> failed to save index " + this.containerPath + " because of the following exception:", System.err); // $NON-NLS-1$ //$NON-NLS-2$ e.printStackTrace(); } return false; } finally { monitor.exitWrite(); // free write lock } return true; }
public boolean execute(IProgressMonitor progressMonitor) { if (this.isCancelled || progressMonitor != null && progressMonitor.isCanceled()) return true; /* ensure no concurrent write access to index */ Index index = this.manager.getIndex( this.containerPath, true, /*reuse index file*/ false /*create if none*/); if (index == null) return true; ReadWriteMonitor monitor = index.monitor; if (monitor == null) return true; // index got deleted since acquired try { monitor.enterWrite(); // ask permission to write index.remove(resourceName); } finally { monitor.exitWrite(); // free write lock } return true; }