public LocalRepoTransactionImpl( final LocalRepoManagerImpl localRepoManager, final boolean write) { this.localRepoManager = AssertUtil.assertNotNull("localRepoManager", localRepoManager); this.persistenceManagerFactory = AssertUtil.assertNotNull( "localRepoManager.persistenceManagerFactory", localRepoManager.getPersistenceManagerFactory()); this.lock = localRepoManager.getLock(); this.write = write; begin(); }
public synchronized void backupParentFileLastModified(final File parentFile) { AssertUtil.assertNotNull("parentFile", parentFile); ParentFileEntry parentFileEntry = parentFile2ParentFileEntry.get(parentFile); if (parentFileEntry == null) { parentFileEntry = new ParentFileEntry(parentFile); parentFile2ParentFileEntry.put(parentFile, parentFileEntry); } ++parentFileEntry.refCount; }
public synchronized void restoreParentFileLastModified(final File parentFile) { AssertUtil.assertNotNull("parentFile", parentFile); final ParentFileEntry parentFileEntry = parentFile2ParentFileEntry.get(parentFile); if (parentFileEntry == null) throw new IllegalStateException( "parentFileEntry == null :: less invocations of restore... than of backup...!!! :: parentFile=" + parentFile); if (--parentFileEntry.refCount == 0) { if (parentFileEntry.lastModified != Long.MIN_VALUE) parentFileEntry.parentFile.setLastModified(parentFileEntry.lastModified); parentFile2ParentFileEntry.remove(parentFile); } }
public ParentFileEntry(final File parentFile) { this.parentFile = AssertUtil.assertNotNull("parentFile", parentFile); this.lastModified = parentFile.exists() ? parentFile.lastModified() : Long.MIN_VALUE; }