Advertisement
sanya5791

Untitled

Apr 3rd, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1.     Thread t;
  2.     public StackRecordDbModel popScreen() {
  3.         Timber.d("popScreen: before take from cache");
  4.         if (t != null && t.isAlive()) {
  5.             try {
  6.                 Timber.d("popScreen: need join");
  7.                 t.join();
  8.             } catch (InterruptedException e) {
  9.                 Timber.e(e, e.getMessage());
  10.             }
  11.         }
  12.         StackRecordDbModel lastRecordCache = stackCache.remove(stackCache.size() - 1);
  13.         Timber.d("popScreen: got cache record=%s", lastRecordCache.screenId());
  14.  
  15.         t = new Thread(() -> {
  16.             StackRecordDbModel lastRecordDb = stackLocalRepository.getRecord(
  17.                     new StackLocalRepository.SelectionLastRecord(claimId, testId));
  18.             stackLocalRepository.removeRecord(lastRecordDb);
  19.             Timber.d("popScreen: removed from DB record=%s", lastRecordDb.screenId());
  20.         });
  21.         t.start();
  22.  
  23.         return lastRecordCache;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement