@Override
  public void onCreate() {
    super.onCreate();

    try {
      cacheManager = createCacheManager(getApplication());
    } catch (CacheCreationException e) {
      Ln.e(e);
      stopSelf();
      return;
    }
    if (cacheManager == null) {
      Ln.e(new CacheCreationException("createCacheManager() can't create a null cacheManager"));
      stopSelf();
      return;
    }

    progressReporter = createRequestRequestListenerNotifier();
    spiceServiceListenerNotifier = createSpiceServiceListenerNotifier();

    final ExecutorService executorService = getExecutorService();
    final NetworkStateChecker networkStateChecker = getNetworkStateChecker();

    requestProcessor = createRequestProcessor(executorService, networkStateChecker);
    requestProcessor.setFailOnCacheError(DEFAULT_FAIL_ON_CACHE_ERROR);

    notification = createDefaultNotification();

    Ln.d("SpiceService instance created.");
  }
 public void removeSpiceServiceListener(final SpiceServiceListener spiceServiceListener) {
   requestProcessor.removeSpiceServiceListener(spiceServiceListener);
 }
 public void dumpState() {
   Ln.v(requestProcessor.toString());
 }
 public void addSpiceServiceListener(final SpiceServiceListener spiceServiceListener) {
   requestProcessor.addSpiceServiceListener(spiceServiceListener);
 }
 public void setFailOnCacheError(final boolean failOnCacheError) {
   requestProcessor.setFailOnCacheError(failOnCacheError);
 }
 public void dontNotifyRequestListenersForRequest(
     final CachedSpiceRequest<?> request,
     final Collection<RequestListener<?>> listRequestListener) {
   requestProcessor.dontNotifyRequestListenersForRequest(request, listRequestListener);
 }
 public boolean isFailOnCacheError() {
   return requestProcessor.isFailOnCacheError();
 }
 public void removeAllDataFromCache() {
   requestProcessor.removeAllDataFromCache();
 }
 public void removeAllDataFromCache(final Class<?> clazz) {
   requestProcessor.removeAllDataFromCache(clazz);
 }
 public boolean removeDataFromCache(final Class<?> clazz, final Object cacheKey) {
   return requestProcessor.removeDataFromCache(clazz, cacheKey);
 }
 public void addRequest(
     final CachedSpiceRequest<?> request, final Set<RequestListener<?>> listRequestListener) {
   currentPendingRequestCount++;
   requestProcessor.addRequest(request, listRequestListener);
   showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
 }