Hi,

On Aug 17, 3:23 am, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:

> Once commute has been called on a Ref (within a transaction of
> course), ref-set and alter cannot be called on it within the same
> transaction.
> This is enforced by the following code from the doSet method in
> LockingTransaction.java.
>
>        if(commutes.containsKey(ref))
>             throw new IllegalStateException("Can't set after commute");
>
> Given that, I'm trying to figure out why the run method in
> LockingTransaction.java contains this code in the loop that is
> responsible for calling all the commute functions a second time during
> the commit.
>
>                     for(Map.Entry<Ref, ArrayList<CFn>> e : 
> commutes.entrySet())
>                     {
>                         Ref ref = e.getKey();
>                         if(sets.contains(ref)) continue;
>                         ...
>
> It seems that the Ref can't be in the sets HashSet if commute was
> called first on the Ref.
> Maybe it's there in case ref-set or alter was called on the Ref before 
> commute.
> In that case, does that mean that the commute functions for that Ref
> won't be called a second time during the commit?

Just guessing here, but isn't the commute using the
newest value of the Ref during commit. When ref-set or
alter was used in the transaction and the transaction
is committing, the value set with ref-set/alter *will* be
the newest value for the Ref, so there is no need to
recompute the value for the commute (it was done
before and it is up-to-date).

Sincerely
Meikel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to