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