code: public void updateCache( final WorkspaceCache workspace, final ChangeSet changes, Transaction transaction ) {
          if (changes == null || changes.isEmpty()) {
              return;
          }
          if (transaction instanceof SynchronizedTransaction) {
              // only issue the changes when the transaction is successfully committed
              transaction.uponCommit(() -> workspace.changed(changes));
              if (workspace instanceof TransactionalWorkspaceCache) {
                  ((TransactionalWorkspaceCache) workspace).changedWithinTransaction(changes);
              }
          } else if (transaction instanceof RollbackOnlyTransaction) {
              // The transaction has been marked for rollback only, so no need to even capture these changes because
              // no changes will ever escape the Session ...
          } else {
              // in all other cases we want to dispatch the changes immediately
              workspace.changed(changes);
          }
      }
docs: Notify the workspace of the supplied changes, if and when the current transaction is completed. If the current thread is
  not associated with a transaction when this method is called (e.g., the transaction was started, changes were made, the
  transaction was committed, and then this method was called), then the workspace is notified immediately. Otherwise, the
  notifications will be accumulated until the current transaction is committed.
  
  @param workspace the workspace to which the changes were made; may not be null
  @param changes the changes; may be null if there are no changes
  @param transaction the transaction with which the changes were made; may not be null