Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (15 sloc) 337 Bytes
require 'rubygems'
require 'java'
require 'mvn:org.clojure:clojure'
java_import 'clojure.lang.Ref'
java_import 'clojure.lang.LockingTransaction'
ref = Ref.new("one")
p ref.deref # "one"
begin
ref.set("two")
rescue java.lang.IllegalStateException
end
LockingTransaction.run_in_transaction do
ref.set("two")
end
p ref.deref # "two"