Provide flag to disable throwing of cache initialization exceptions
PiperOrigin-RevId: 241497141
This commit is contained in:
parent
9dc22c3086
commit
42b641221c
@ -62,6 +62,7 @@ public final class SimpleCache implements Cache {
|
|||||||
private static final HashSet<File> lockedCacheDirs = new HashSet<>();
|
private static final HashSet<File> lockedCacheDirs = new HashSet<>();
|
||||||
|
|
||||||
private static boolean cacheFolderLockingDisabled;
|
private static boolean cacheFolderLockingDisabled;
|
||||||
|
private static boolean cacheInitializationExceptionsDisabled;
|
||||||
|
|
||||||
private final File cacheDir;
|
private final File cacheDir;
|
||||||
private final CacheEvictor evictor;
|
private final CacheEvictor evictor;
|
||||||
@ -100,6 +101,16 @@ public final class SimpleCache implements Cache {
|
|||||||
lockedCacheDirs.clear();
|
lockedCacheDirs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Deletes all content belonging to a cache instance.
|
||||||
*
|
*
|
||||||
@ -272,7 +283,7 @@ public final class SimpleCache implements Cache {
|
|||||||
* @throws CacheException If an error occurred during initialization.
|
* @throws CacheException If an error occurred during initialization.
|
||||||
*/
|
*/
|
||||||
public synchronized void checkInitialization() throws CacheException {
|
public synchronized void checkInitialization() throws CacheException {
|
||||||
if (initializationException != null) {
|
if (!cacheInitializationExceptionsDisabled && initializationException != null) {
|
||||||
throw initializationException;
|
throw initializationException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user