/** * Acquire a lock on the index file. Method will not return until the lock * is acquired or an error is thrown. * * @throws IOException if any errors occur. */ private void lockIndex() throws IOException { //log.debug(" * Locking Index : " + getId()); indexLock.getLock(); //log.debug(" * Index locked : " + getId()); }
/** * Release a lock on the index file. Method will not return until the lock * is released or an error is thrown. * * @throws IOException if any errors occur. */ private void unlockIndex() throws IOException { //log.debug(" * Unlocking Index : " + getId()); indexLock.release(); //log.debug(" * Index unlocked : " + getId()); }
private void buildLock() { try { String lockPath = getPath() + File.separator + "manifest.lock"; lockFile = new File(lockPath); if (!lockFile.exists()) { // log.debug("Creating new lock file : " // + lockFile.getAbsolutePath()); lockFile.getParentFile().mkdirs(); lockFile.createNewFile(); } manifestLock = new DummyFileLock(lockPath); } catch (IOException ex) { log.error("Failed accessing manifest lock", ex); } }
lockFile.createNewFile(); indexLock = new DummyFileLock(lockFile.getAbsolutePath()); } catch(IOException ex) { throw new TransformerException(
private void lockManifest() { try { // log.debug(" * Locking Manifest : " + getId()); manifestLock.getLock(); // log.debug(" * Manifest locked : " + getId()); } catch (IOException ex) { log.error("Failed acquiring manifest lock : ", ex); } }
private void unlockManifest() { try { // log.debug(" * Unlocking Manifest : " + getId()); manifestLock.release(); // log.debug(" * Manifest unlocked : " + getId()); } catch (IOException ex) { log.error("Failed releasing manifest lock : ", ex); } }