Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A doubt about shutdown function #321

Closed
simpleton opened this issue Dec 5, 2013 · 4 comments
Closed

A doubt about shutdown function #321

simpleton opened this issue Dec 5, 2013 · 4 comments

Comments

@simpleton
Copy link

How could I reuse Picasso? The lib only supplied shut down function.

If shutdown means destroy the module, why not set instance to null?

How could I use this function

@JakeWharton
Copy link
Member

It's only use is if you are creating scoped Picasso instances and then
throwing them away. It should be a rare occasion that someone would use
this function.
On Dec 5, 2013 9:46 AM, "Sim Sun" notifications@github.com wrote:

How could I reuse Picasso? The lib only supplied shut down function.

If shutdown means destroy the module, why not set instance to null?

How could I use this function


Reply to this email directly or view it on GitHubhttps://github.com//issues/321
.

@dnkoutso
Copy link
Collaborator

It will also shutdown all the threads used by Picasso.

You can keep your reference as long as you want or if you want to clear out images from memory cache to free memory then shutdown is a good use case.

For example, user A signs in and uses Picasso to download 50 images, signs out and then user B signs in. Perhaps shutting down makes sense then.

@simpleton
Copy link
Author

But default singleton wouldn't be shutdown. It makes me confused.

 /** Stops this instance from accepting further requests. */
 public void shutdown() {
   if (this == singleton) {
   throw new UnsupportedOperationException("Default singleton instance cannot be shutdown.");
 }
 if (shutdown) {
   return;
 }

@JakeWharton
Copy link
Member

Correct. Don't ever shutdown the singleton version.
On Dec 10, 2013 10:25 PM, "Sim Sun" notifications@github.com wrote:

But default singleton wouldn't be shutdown. It makes me confused.

/** Stops this instance from accepting further requests. */
public void shutdown() {
if (this == singleton) {
throw new UnsupportedOperationException("Default singleton instance cannot be shutdown.");
}
if (shutdown) {
return;
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/321#issuecomment-30297658
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants