@Test public void shutdownDoesNotCloseCacheIfSharedClient() throws Exception { okhttp3.Cache cache = new okhttp3.Cache(temporaryFolder.getRoot(), 100); OkHttpClient client = new OkHttpClient.Builder().cache(cache).build(); new OkHttp3Downloader(client).shutdown(); assertThat(cache.isClosed()).isFalse(); }
@Override public void shutdown() { if (!sharedClient) { if (cache != null) { try { cache.close(); } catch (IOException ignored) { } } } }
OkHttp3Downloader implements Downloader { @Override public void shutdown() { if (!sharedClient) { if (cache != null) { try { cache.close(); } catch (IOException ignored) { } } } } }
OkHttp3Downloader implements Downloader { @Override public void shutdown() { if (!sharedClient) { if (cache != null) { try { cache.close(); } catch (IOException ignored) { } } } } OkHttp3Downloader(final Context context);  OkHttp3Downloader(final File cacheDir);  OkHttp3Downloader(final Context context, final long maxSize);  OkHttp3Downloader(final File cacheDir, final long maxSize);  OkHttp3Downloader(OkHttpClient client);  OkHttp3Downloader(Call.Factory client); }
OkHttp3Downloader implements Downloader { @Override public void shutdown() { if (!sharedClient) { if (cache != null) { try { cache.close(); } catch (IOException ignored) { } } } } OkHttp3Downloader(final Context context);  OkHttp3Downloader(final File cacheDir);  OkHttp3Downloader(final Context context, final long maxSize);  OkHttp3Downloader(final File cacheDir, final long maxSize);  OkHttp3Downloader(OkHttpClient client);  OkHttp3Downloader(Call.Factory client); @Override Response load(@NonNull Uri uri, int networkPolicy); @Override void shutdown(); }
OkHttp3Downloader implements Downloader { @Override public void shutdown() { if (!sharedClient) { if (cache != null) { try { cache.close(); } catch (IOException ignored) { } } } } OkHttp3Downloader(final Context context);  OkHttp3Downloader(final File cacheDir);  OkHttp3Downloader(final Context context, final long maxSize);  OkHttp3Downloader(final File cacheDir, final long maxSize);  OkHttp3Downloader(OkHttpClient client);  OkHttp3Downloader(Call.Factory client); @Override Response load(@NonNull Uri uri, int networkPolicy); @Override void shutdown();  }