public void finish(final RepositorySessionFinishDelegate delegate) {
   if (this.status == SessionStatus.ACTIVE) {
     this.status = SessionStatus.DONE;
     delegate.deferredFinishDelegate(delegateQueue).onFinishSucceeded(this, this.getBundle(null));
   } else {
     Logger.error(LOG_TAG, "Tried to finish() an unstarted or already finished session");
     Exception e = new InvalidSessionTransitionException(null);
     delegate.deferredFinishDelegate(delegateQueue).onFinishFailed(e);
   }
   Logger.info(LOG_TAG, "Shutting down work queues.");
   //   storeWorkQueue.shutdown();
   //   delegateQueue.shutdown();
 }
 /**
  * Just like finish(), but doesn't do any work that should only be performed at the end of a
  * successful sync, and can be called any time.
  *
  * @param delegate
  */
 public void abort(RepositorySessionFinishDelegate delegate) {
   this.status = SessionStatus.DONE; // TODO: ABORTED?
   delegate.deferredFinishDelegate(delegateQueue).onFinishSucceeded(this, this.getBundle(null));
 }