Created
December 30, 2016 09:32
-
-
Save FreeFly19/3992b559d522474f4c8c71af477dd349 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ImageDownloadTask implements Runnable { | |
| private URL imageURL; | |
| public void run() { | |
| for(int i = 0; i < 3; i++) { | |
| if(isImageDownloaded()) break; // return | |
| } | |
| } | |
| private boolean isImageDownloaded() { | |
| try { | |
| downloadImage(); | |
| return true; | |
| } catch(Exception e) { | |
| return false; | |
| } | |
| } | |
| private downloadImage() throws Exception { | |
| // Your implementation | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment