code: private void commitContexts(boolean accept, boolean all) {
          Stack<IManagedContext<?>> stack = commitStack;
          commitStack = new Stack<>();
          // First, commit or cancel all pending context changes.
          for (IManagedContext<?> managedContext : stack) {
              if (managedContext.isPending()) {
                  managedContext.commit(accept);
              }
          }
          // Then notify subscribers of the changes.
          while (!stack.isEmpty()) {
              stack.pop().notifySubscribers(accept, all);
          }
      }
docs: Commit or cancel all pending context changes.
  
  @param accept If true, pending changes are committed. If false, they are canceled.
  @param all If false, only polled subscribers are notified.