Skip to content

Instantly share code, notes, and snippets.

@headius headius/gist:734247
Created Dec 9, 2010

What would you like to do?
~/projects ➔ gem install cloby
Successfully installed cloby-0.0.1-java
1 gem installed
Installing ri documentation for cloby-0.0.1-java...
Installing RDoc documentation for cloby-0.0.1-java...
~/projects ➔ cat simple.rb
require 'cloby'
class MyClojureObj < Clojure::Object
def initialize
dosync { @foo = 'foo' }
attr_accessor :foo
obj =
puts " = " +
puts "Setting to 'bar'" = 'bar'
rescue ConcurrencyError
puts "Oops, need a transaction"
puts "Trying again with a transaction"
dosync { = 'bar' }
puts "Success"
puts " == " +
~/projects ➔ jruby -rubygems -rclojure/clojure-1.0.0.jar simple.rb = foo
Setting to 'bar'
Oops, need a transaction
Trying again with a transaction
Success == bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.