Commit 42b64122 by olly Committed by Oliver Woodman

Provide flag to disable throwing of cache initialization exceptions

PiperOrigin-RevId: 241497141
parent 9dc22c30
......@@ -62,6 +62,7 @@ public final class SimpleCache implements Cache {
private static final HashSet<File> lockedCacheDirs = new HashSet<>();
private static boolean cacheFolderLockingDisabled;
private static boolean cacheInitializationExceptionsDisabled;
private final File cacheDir;
private final CacheEvictor evictor;
......@@ -101,6 +102,16 @@ public final class SimpleCache implements Cache {
}
/**
* Disables throwing of cache initialization exceptions.
*
* @deprecated Don't use this. Provided for problematic upgrade cases only.
*/
@Deprecated
public static void disableCacheInitializationExceptions() {
cacheInitializationExceptionsDisabled = true;
}
/**
* Deletes all content belonging to a cache instance.
*
* @param cacheDir The cache directory.
......@@ -272,7 +283,7 @@ public final class SimpleCache implements Cache {
* @throws CacheException If an error occurred during initialization.
*/
public synchronized void checkInitialization() throws CacheException {
if (initializationException != null) {
if (!cacheInitializationExceptionsDisabled && initializationException != null) {
throw initializationException;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment