Changeset 13252 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2017-12-28T03:04:16+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r13250 r13252 46 46 import java.util.concurrent.ExecutorService; 47 47 import java.util.concurrent.Executors; 48 import java.util.function.Consumer; 48 49 import java.util.regex.Matcher; 49 50 import java.util.regex.Pattern; … … 659 660 * 660 661 * This method returns immediately and runs the image request asynchronously. 662 * @param action the action that will deal with the image 661 663 * 662 664 * @return the future of the requested image 663 * @since 1 0714664 */ 665 public CompletableFuture< ImageIcon> getAsync() {665 * @since 13252 666 */ 667 public CompletableFuture<Void> getAsync(Consumer<? super ImageIcon> action) { 666 668 return isRemote() 667 ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER) 668 : CompletableFuture.completedFuture(get()) ;669 ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER).thenAcceptAsync(action) 670 : CompletableFuture.completedFuture(get()).thenAccept(action); 669 671 } 670 672 … … 703 705 * 704 706 * This method returns immediately and runs the image request asynchronously. 707 * @param action the action that will deal with the image 705 708 * 706 709 * @return the future of the requested image 707 * @since 1 0714708 */ 709 public CompletableFuture< ImageResource> getResourceAsync() {710 * @since 13252 711 */ 712 public CompletableFuture<Void> getResourceAsync(Consumer<? super ImageResource> action) { 710 713 return isRemote() 711 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER) 712 : CompletableFuture.completedFuture(getResource()) ;714 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER).thenAcceptAsync(action) 715 : CompletableFuture.completedFuture(getResource()).thenAccept(action); 713 716 } 714 717
Note:
See TracChangeset
for help on using the changeset viewer.