コード例 #1
0
 @Override
 public void handleWBO(CryptoRecord record) {
   workTracker.incrementOutstanding();
   try {
     delegate.onFetchedRecord(record);
   } catch (Exception ex) {
     Logger.warn(LOG_TAG, "Got exception calling onFetchedRecord with WBO.", ex);
     // TODO: handle this better.
     throw new RuntimeException(ex);
   } finally {
     workTracker.decrementOutstanding();
   }
 }
コード例 #2
0
 @Override
 public void handleRequestError(final Exception ex) {
   removeRequestFromPending();
   Logger.warn(LOG_TAG, "Got request error.", ex);
   // When we're done processing other events, finish.
   workTracker.delayWorkItem(
       new Runnable() {
         @Override
         public void run() {
           Logger.debug(LOG_TAG, "Running onFetchFailed.");
           delegate.onFetchFailed(ex, null);
         }
       });
 }
コード例 #3
0
    @Override
    public void handleRequestSuccess(SyncStorageResponse response) {
      Logger.debug(LOG_TAG, "Fetch done.");
      removeRequestFromPending();

      final long normalizedTimestamp = getNormalizedTimestamp(response);
      Logger.debug(LOG_TAG, "Fetch completed. Timestamp is " + normalizedTimestamp);

      // When we're done processing other events, finish.
      workTracker.delayWorkItem(
          new Runnable() {
            @Override
            public void run() {
              Logger.debug(LOG_TAG, "Delayed onFetchCompleted running.");
              // TODO: verify number of returned records.
              delegate.onFetchCompleted(normalizedTimestamp);
            }
          });
    }