1 package com.bumptech.glide.request; 2 3 import com.bumptech.glide.request.target.Target; 4 5 import java.util.concurrent.Future; 6 7 /** 8 * An interface for an object that is both a {@link com.bumptech.glide.request.target.Target} and a 9 * {@link java.util.concurrent.Future}. For example: 10 * <pre> 11 * {@code 12 * FutureTarget<Bitmap> futureTarget = Glide.with(fragment) 13 * .load("http://goo.gl/1asf12") 14 * .asBitmap() 15 * .into(250, 250); 16 * Bitmap myBitmap = futureTarget.get(); 17 * ... // do things with bitmap and then release when finished: 18 * Glide.clear(futureTarget); 19 * } 20 * </pre> 21 * 22 * <p> 23 * Note - {@link #get()} and {@link #get(long, java.util.concurrent.TimeUnit)} must be called 24 * off of the main thread or they will block forever. 25 * </p> 26 * 27 * @param <R> The type of resource this FutureTarget will retrieve. 28 */ 29 public interface FutureTarget<R> extends Future<R>, Target<R> { 30 31 /** 32 * Safely clears the target from a background thread to release its resources. 33 */ clear()34 void clear(); 35 } 36