public void tickle(boolean wifiOff) { synchronized (mCache) { if (wifiOff) { mBssQueues.clear(); } else { long now = System.currentTimeMillis(); Iterator<Map.Entry<Long, LinkedList<QuerySet>>> bssIterator = mBssQueues.entrySet().iterator(); while (bssIterator.hasNext()) { // Get the list of entries for this BSSID Map.Entry<Long, LinkedList<QuerySet>> bssEntries = bssIterator.next(); Iterator<QuerySet> querySetIterator = bssEntries.getValue().iterator(); while (querySetIterator.hasNext()) { QuerySet querySet = querySetIterator.next(); QueryEntry queryEntry = querySet.peek(); long age = queryEntry.age(now); if (age > RequeryTimeHigh) { // Timed out entry, move on to the next. queryEntry = querySet.pop(); if (queryEntry == null) { // Empty query set, update status and remove it. querySet.getOsuInfo().setIconStatus(OSUInfo.IconStatus.NotAvailable); querySetIterator.remove(); } else { // Start a query on the next entry and bail out of the set iteration initiateQuery(querySet.getBssid()); break; } } else if (age > RequeryTimeLow) { // Re-issue queries for qualified entries and bail out of set iteration initiateQuery(querySet.getBssid()); break; } } if (bssEntries.getValue().isEmpty()) { // Kill the whole bucket if the set list is empty bssIterator.remove(); } } } } }