void calculateCounters(){
  if (!isDBAvailable())   return;
  long time=System.currentTimeMillis();
  int total=0;
  write.lock();
  try {
    countResetFeedsAndCategories();
    total+=countFeedsWithUnread();
    countCategoriesWithUnread();
    countSpecialCategories(total);
  }
  finally {
    write.unlock();
  }
  Log.i(TAG,String.format("Recalculated counters, total unread: %s (took %sms)",total,(System.currentTimeMillis() - time)));
}

void calculateCounters ( ) { if ( ! isDBAvailable ( ) ) return ; long time = System . currentTimeMillis ( ) ; int total = 0 ; write . lock ( ) ; try { countResetFeedsAndCategories ( ) ; total += countFeedsWithUnread ( ) ; countCategoriesWithUnread ( ) ; countSpecialCategories ( total ) ; } finally { write . unlock ( ) ; } Log . i ( TAG , String . format ( "Recalculated counters, total unread: %s (took %sms)" , total , ( System . currentTimeMillis ( ) - time ) ) ) ; }
set unread counters for feeds and categories according to real amount of unread articles . split up the tasks in single transactions so we can do other work in between .
