From 3e17080c02a049c37f8a20ffae2fff35e9fa007e Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 18 Nov 2019 13:38:06 +0000 Subject: [PATCH] Remove SimpleCache hacks that are no longer used PiperOrigin-RevId: 281049383 --- .../upstream/cache/SimpleCache.java | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java index e618fcad75..cf8056f5a9 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java @@ -61,9 +61,6 @@ public final class SimpleCache implements Cache { private static final HashSet lockedCacheDirs = new HashSet<>(); - private static boolean cacheFolderLockingDisabled; - private static boolean cacheInitializationExceptionsDisabled; - private final File cacheDir; private final CacheEvictor evictor; private final CachedContentIndex contentIndex; @@ -85,33 +82,6 @@ public final class SimpleCache implements Cache { return lockedCacheDirs.contains(cacheFolder.getAbsoluteFile()); } - /** - * Disables locking the cache folders which {@link SimpleCache} instances are using and releases - * any previous lock. - * - *

The locking prevents multiple {@link SimpleCache} instances from being created for the same - * folder. Disabling it may cause the cache data to be corrupted. Use at your own risk. - * - * @deprecated Don't create multiple {@link SimpleCache} instances for the same cache folder. If - * you need to create another instance, make sure you call {@link #release()} on the previous - * instance. - */ - @Deprecated - public static synchronized void disableCacheFolderLocking() { - cacheFolderLockingDisabled = true; - 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. * @@ -304,7 +274,7 @@ public final class SimpleCache implements Cache { * @throws CacheException If an error occurred during initialization. */ public synchronized void checkInitialization() throws CacheException { - if (!cacheInitializationExceptionsDisabled && initializationException != null) { + if (initializationException != null) { throw initializationException; } } @@ -828,15 +798,10 @@ public final class SimpleCache implements Cache { } private static synchronized boolean lockFolder(File cacheDir) { - if (cacheFolderLockingDisabled) { - return true; - } return lockedCacheDirs.add(cacheDir.getAbsoluteFile()); } private static synchronized void unlockFolder(File cacheDir) { - if (!cacheFolderLockingDisabled) { - lockedCacheDirs.remove(cacheDir.getAbsoluteFile()); - } + lockedCacheDirs.remove(cacheDir.getAbsoluteFile()); } }