public ItemLoadedFuture getPdu(
      Uri uri, boolean requestSlideshow, final ItemLoadedCallback<PduLoaded> callback) {
    if (uri == null) {
      throw new NullPointerException();
    }

    PduCacheEntry cacheEntry = null;
    synchronized (mPduCache) {
      if (!mPduCache.isUpdating(uri)) {
        cacheEntry = mPduCache.get(uri);
      }
    }
    final SlideshowModel slideshow =
        (requestSlideshow && !DEBUG_DISABLE_CACHE) ? mSlideshowCache.get(uri) : null;

    final boolean slideshowExists = !requestSlideshow || slideshow != null;
    final boolean pduExists = cacheEntry != null && cacheEntry.getPdu() != null;
    final boolean taskExists = mPendingTaskUris.contains(uri);
    final boolean newTaskRequired = (!pduExists || !slideshowExists) && !taskExists;
    final boolean callbackRequired = callback != null;

    if (pduExists && slideshowExists) {
      if (callbackRequired) {
        PduLoaded pduLoaded = new PduLoaded(cacheEntry.getPdu(), slideshow);
        callback.onItemLoaded(pduLoaded, null);
      }
      return new NullItemLoadedFuture();
    }

    if (callbackRequired) {
      addCallback(uri, callback);
    }

    if (newTaskRequired) {
      mPendingTaskUris.add(uri);
      Runnable task = new PduTask(uri, requestSlideshow);
      mExecutor.execute(task);
    }
    return new ItemLoadedFuture() {
      private boolean mIsDone;

      public void cancel(Uri uri) {
        cancelCallback(callback);
        removePdu(uri); // the pdu and/or slideshow might be half loaded. Make sure
        // we load fresh the next time this uri is requested.
      }

      public void setIsDone(boolean done) {
        mIsDone = done;
      }

      public boolean isDone() {
        return mIsDone;
      }
    };
  }
  public PduLoaderManager(final Context context) {
    super(context);

    mSlideshowCache = new SimpleCache<Uri, SlideshowModel>(8, 16, 0.75f, false);
    mPduCache = PduCache.getInstance();
    mPduPersister = PduPersister.getPduPersister(context);
    mContext = context;
  }
  @Override
  public void clear() {
    super.clear();

    synchronized (mPduCache) {
      mPduCache.purgeAll();
    }
    mSlideshowCache.clear();
  }
 public void removePdu(Uri uri) {
   if (Log.isLoggable(TAG, Log.DEBUG)) {
     Log.d(TAG, "removePdu: " + uri);
   }
   if (uri != null) {
     synchronized (mPduCache) {
       mPduCache.purge(uri);
     }
     mSlideshowCache.remove(uri);
   }
 }