Code example for LinkedBlockingQueue

0
    protected final Handler mCallbackHandler;
 
    BackgroundLoaderManager(Context context) {
        mPendingTaskUris = new HashSet<Uri>();
        mCallbacks = new HashMap<Uri, Set<ItemLoadedCallback>>();
        final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
        final int poolSize = MAX_THREADS;
        mExecutor = new ThreadPoolExecutor(
                poolSize, poolSize, 5, TimeUnit.SECONDS, queue,
                new BackgroundLoaderThreadFactory(getTag())); 
        mCallbackHandler = new Handler();
    } 
 
    /** 
     * Release memory if possible. 
     */ 
    public void onLowMemory() { 
        clear(); 
    } 
 
    public void clear() {