void (@Nullable Result result) { if (result != null) { myResultHandler.accept(result); debug("Handled result: " + result); } synchronized (LOCK) { if (myAwaitingRequests.isEmpty()) { myRunningTask = null; debug("No more requests"); } else { myRunningTask = startNewBackgroundTask(); debug("Restarted a bg task " + myRunningTask); } } }