void () { assert ApplicationManager.getApplication().isUnitTestMode(); List<Runnable> result = new ArrayList<>(); synchronized (LOCK) { for (Request request : myRequests) { Runnable existingTask = request.cancel(); if (existingTask != null) { result.add(existingTask); } } myRequests.clear(); } for (Runnable task : result) { task.run(); } }