void () { myQueue.queue(DisposableUpdate.createDisposable(this, "update", () -> { List<GitRepository> withIncoming; List<GitRepository> withOutgoing; boolean shouldRequestRemoteInfo; synchronized (LOCK) { withIncoming = new ArrayList<>(myDirtyReposWithIncoming); withOutgoing = new ArrayList<>(myDirtyReposWithOutgoing); shouldRequestRemoteInfo = myShouldRequestRemoteInfo; myDirtyReposWithIncoming.clear(); myDirtyReposWithOutgoing.clear(); myShouldRequestRemoteInfo = false; } for (GitRepository r : withOutgoing) { myLocalBranchesWithOutgoing.put(r, calculateBranchesWithOutgoing(r)); } for (GitRepository r : withIncoming) { if (shouldRequestRemoteInfo) { myLocalBranchesToFetch.put(r, calculateBranchesToFetch(r)); } myLocalBranchesWithIncoming.put(r, calcBranchesWithIncoming(r)); } BackgroundTaskUtil.syncPublisher(myProject, GIT_INCOMING_OUTGOING_CHANGED).incomingOutgoingInfoChanged(); })); }