diff options
author | 2017-06-16 21:34:09 +0200 | |
---|---|---|
committer | 2017-06-19 18:24:42 +0200 | |
commit | e44da5a00f1094335fe143deac47684215f45b7e (patch) | |
tree | 614b243d96fd65e7f7d1ac1d9d31b26a827980f8 /src/main/java/com/google/devtools/build/lib/actions/cache | |
parent | 4929ad79865f8c13ef3b33c827040f4a037e4afe (diff) |
Close file handles in ActionCache before bazel clean
Fixed https://github.com/bazelbuild/bazel/issues/3043
Change-Id: Ibbe6ba945bbd439cd84676fcb7fd7ecbbb99e5f0
PiperOrigin-RevId: 159261292
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/cache')
3 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/ActionCache.java b/src/main/java/com/google/devtools/build/lib/actions/cache/ActionCache.java index 1e123e5f93..59eb31ff09 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/ActionCache.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/ActionCache.java @@ -187,6 +187,9 @@ public interface ActionCache { */ long save() throws IOException; + /** Clear the action cache, closing all opened file handle. */ + void clear(); + /** * Dumps action cache content into the given PrintStream. */ diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java b/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java index 1dee81126b..95a986053e 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/CompactPersistentActionCache.java @@ -293,6 +293,12 @@ public class CompactPersistentActionCache implements ActionCache { } @Override + public void clear() { + indexer.clear(); + map.clear(); + } + + @Override public synchronized String toString() { StringBuilder builder = new StringBuilder(); // map.size() - 1 to avoid counting the validation key. diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/PersistentStringIndexer.java b/src/main/java/com/google/devtools/build/lib/actions/cache/PersistentStringIndexer.java index bf8d4384fd..28970bfca3 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/PersistentStringIndexer.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/PersistentStringIndexer.java @@ -77,11 +77,6 @@ final class PersistentStringIndexer extends CanonicalStringIndexer { throw new UnsupportedOperationException(); } - @Override - public void clear() { - throw new UnsupportedOperationException(); - } - public void flush() { super.forceFlush(); } |