@Test public void shutdownTwice() { picasso.shutdown(); picasso.shutdown(); verify(cache).clear(); verify(stats).shutdown(); verify(dispatcher).shutdown(); assertThat(picasso.shutdown).isTrue(); }
public void shutdown() { if (this == singleton) { throw new UnsupportedOperationException("Default singleton instance cannot be shutdown."); } if (shutdown) { return; } cache.clear(); cleanupThread.shutdown(); stats.shutdown(); dispatcher.shutdown(); for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; }
Picasso { public void shutdown() { if (this == singleton) { throw new UnsupportedOperationException("Default singleton instance cannot be shutdown."); } if (shutdown) { return; } cache.clear(); cleanupThread.shutdown(); stats.shutdown(); dispatcher.shutdown(); for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; } }
Picasso { public void shutdown() { if (this == singleton) { throw new UnsupportedOperationException("Default singleton instance cannot be shutdown."); } if (shutdown) { return; } cache.clear(); cleanupThread.shutdown(); stats.shutdown(); dispatcher.shutdown(); for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); }
Picasso { public void shutdown() { if (this == singleton) { throw new UnsupportedOperationException("Default singleton instance cannot be shutdown."); } if (shutdown) { return; } cache.clear(); cleanupThread.shutdown(); stats.shutdown(); dispatcher.shutdown(); for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso); }
Picasso { public void shutdown() { if (this == singleton) { throw new UnsupportedOperationException("Default singleton instance cannot be shutdown."); } if (shutdown) { return; } cache.clear(); cleanupThread.shutdown(); stats.shutdown(); dispatcher.shutdown(); for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) { deferredRequestCreator.cancel(); } targetToDeferredRequestCreator.clear(); shutdown = true; } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso);  }