FileHistoryCache.java revision f4216ce32e4859fd256a197d10d19a0fdb9f468c
290N/A * The contents of this file are subject to the terms of the 290N/A * Common Development and Distribution License (the "License"). 290N/A * You may not use this file except in compliance with the License. 290N/A * language governing permissions and limitations under the License. 290N/A * When distributing Covered Code, include this CDDL HEADER in each 290N/A * If applicable, add the following below this CDDL HEADER, with the 290N/A * fields enclosed by brackets "[]" replaced with your own identifying 290N/A * information: Portions Copyright [yyyy] [name of copyright owner] 290N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3158N/A * Use is subject to license terms. 1660N/A * Get a <code>File</code> object describing the cache file. 1660N/A * @param file the file to find the cache for 1660N/A * @return file that might contain cached history for <code>file</code> 290N/A * Read history from a file. 1498N/A "Unable to create cache directory '" +
dir +
"'.");
2310N/A // We have a problem that multiple threads may access the cache layer 2310N/A // at the same time. Since I would like to avoid read-locking, I just 2852N/A // serialize the write access to the cache file. The generation of the 2852N/A // cache file would most likely be executed during index generation, and 2852N/A // that happens sequencial anyway.... 2852N/A // Generate the file with a temporary name and move it into place when 2535N/A // I'm done so I don't have to protect the readers for partially updated 395N/A "Cachefile exists, and I could not delete it.");
395N/A // In this case, we've found a file for which the SCM has no history 1302N/A // An example is a non-SCCS file somewhere in an SCCS-controlled 395N/A // Don't cache history-information for directories, since the 3139N/A // history information on the directory may change if a file in 3139N/A // a sub-directory change. This will cause us to present a stale 3139N/A // history log until a the current directory is updated and 3139N/A // invalidates the cache entry. 3139N/A // retrieving the history takes too long, cache it! 395N/A * Check if the cache is up to date for the specified file. 3139N/A * @param file the file to check 3139N/A * @param cachedFile the file which contains the cached history for 3139N/A * @return {@code true} if the cache is up to date, {@code false} otherwise 3139N/A * Check if the directory is in the cache. 3139N/A * @param directory the directory to check 2516N/A * @return {@code true} if the directory is in the cache